← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 611059] Re: Using non-char _rec_name columns fails with unclear traceback (should provide better feedback)

 

** Summary changed:

- Using non-char _rec_name columns fails with obscure traceback
+ Using non-char _rec_name columns fails with unclear traceback (should provide better feedback)

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/611059

Title:
  Using non-char _rec_name columns fails with unclear traceback (should provide better feedback)

Status in OpenObject Server:
  Confirmed

Bug description:
  I have an object with:

_name = 'citrus.truck.load'
_rec_name = 'load_id'

_columns = { 'load_id: fields.integer('Load ID'),
etc...
}

And another object with:

 _columns = {
        'load_id': fields.many2one('citrus.truck.load', 'Load ID', select=True, required=True),
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/openerp/server/bin/netsvc.py", line 401, in dispatch
    result = ExportService.getService(service_name).dispatch(method, auth, params)
  File "/usr/lib/openerp/server/bin/service/web_services.py", line 584, in dispatch
    res = fn(db, uid, *params)
  File "/usr/lib/openerp/server/bin/addons/base_module_record/base_module_record.py", line 43, in execute
    res = super(recording_objects_proxy, self).execute(*args, **argv)
  File "/usr/lib/openerp/server/bin/osv/osv.py", line 57, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/usr/lib/openerp/server/bin/osv/osv.py", line 133, in execute
    res = pool.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/usr/lib/openerp/server/bin/osv/osv.py", line 123, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/usr/lib/openerp/server/bin/osv/orm.py", line 3871, in name_search
    return self._name_search(cr, user, name, args, operator, context, limit)
  File "/usr/lib/openerp/server/bin/osv/orm.py", line 3852, in _name_search
    ids = self.search(cr, user, args, limit=limit, context=context)
  File "/usr/lib/openerp/server/bin/osv/orm.py", line 3807, in search
    cr.execute('select %s.id from ' % self._table + ','.join(tables) +qu1+' order by '+order_by+limit_str+offset_str, qu2)
  File "/usr/lib/openerp/server/bin/sql_db.py", line 74, in wrapper
    return f(self, *args, **kwargs)
  File "/usr/lib/openerp/server/bin/sql_db.py", line 119, in execute
    res = self._obj.execute(query, params)
ProgrammingError: operator does not exist: integer ~~* unknown
LINE 1: ...trus_truck_load" where (citrus_truck_load.load_id ilike E'%0...
                                                             ^
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.