Using non-char _rec_name columns fails with unclear traceback (should provide better feedback)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Server (MOVED TO GITHUB) |
Confirmed
|
Wishlist
|
OpenERP's Framework R&D |
Bug Description
I have an object with:
_name = 'citrus.truck.load'
_rec_name = 'load_id'
_columns = { 'load_id: fields.
etc...
}
And another object with:
_columns = {
'load_id': fields.
etc...
}
When I search for a Load ID in the second object by clicking the binoculars I get the list of citrus.truck.loads. That's good. But when I enter a full or part ID and hit tab I get a backtrace:
File "/usr/lib/
result = ExportService.
File "/usr/lib/
res = fn(db, uid, *params)
File "/usr/lib/
res = super(recording
File "/usr/lib/
return f(self, dbname, *args, **kwargs)
File "/usr/lib/
res = pool.execute_cr(cr, uid, obj, method, *args, **kw)
File "/usr/lib/
return getattr(object, method)(cr, uid, *args, **kw)
File "/usr/lib/
return self._name_
File "/usr/lib/
ids = self.search(cr, user, args, limit=limit, context=context)
File "/usr/lib/
cr.
File "/usr/lib/
return f(self, *args, **kwargs)
File "/usr/lib/
res = self._obj.
ProgrammingError: operator does not exist: integer ~~* unknown
LINE 1: ...trus_truck_load" where (citrus_
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
OpenERP assumes the target field is char and tries to do a search using ILIKE which doesn't work with integer fields like this.
Changed in openobject-server: | |
status: | New → Confirmed |
summary: |
- Many2one search doesn't work with integer fields. + Using non-char _rec_name columns fails with obscure traceback |
summary: |
- Using non-char _rec_name columns fails with obscure traceback + Using non-char _rec_name columns fails with unclear traceback (should + provide better feedback) |
Hi Martin,
We confirm the error.
Generally, the standard says that the _rec_name field should always be of type char(string).
This field(if referenced as m2o) is used to represent the record.
If the field is not supposed to be of type char, one should override the name_get() method and return a string that can serve the aim.
There is a fix available, but it is possible that we have to cover all non-char type fields,operators as well.
Hope this helps.
Thanks.