[IMP] models: name_search() should call _name_search()
This avoids code duplication between methods, and keeps backward compatibility with existing code overriding _name_search().
This commit is contained in:
parent
e95fc488db
commit
068d4c487e
|
@ -1729,12 +1729,7 @@ class BaseModel(object):
|
||||||
:rtype: list
|
:rtype: list
|
||||||
:return: list of pairs ``(id, text_repr)`` for all matching records.
|
:return: list of pairs ``(id, text_repr)`` for all matching records.
|
||||||
"""
|
"""
|
||||||
args = list(args or [])
|
return self._name_search(name, args, operator, limit=limit)
|
||||||
if not self._rec_name:
|
|
||||||
_logger.warning("Cannot execute name_search, no _rec_name defined on %s", self._name)
|
|
||||||
elif not (name == '' and operator == 'ilike'):
|
|
||||||
args += [(self._rec_name, operator, name)]
|
|
||||||
return self.search(args, limit=limit).name_get()
|
|
||||||
|
|
||||||
def _name_search(self, cr, user, name='', args=None, operator='ilike', context=None, limit=100, name_get_uid=None):
|
def _name_search(self, cr, user, name='', args=None, operator='ilike', context=None, limit=100, name_get_uid=None):
|
||||||
# private implementation of name_search, allows passing a dedicated user
|
# private implementation of name_search, allows passing a dedicated user
|
||||||
|
|
Loading…
Reference in New Issue