diff options
| author | Xavier ALT <xal@odoo.com> | 2019-09-11 17:11:33 +0000 |
|---|---|---|
| committer | Xavier ALT <xal@odoo.com> | 2019-09-11 17:11:33 +0000 |
| commit | bea0a9edfedb133bf47ba7025e3e18f1c53e9ec3 (patch) | |
| tree | 3bd8db65f0ed3a5f5e6c04d6ab58b91020e688bd /odoo/addons/test_impex | |
| parent | 81e198aa5d43fe28cc0b5e9af5279db06559244f (diff) | |
[FIX] base, *: ensure name_search() returns lazy name_get() result
To avoid slowing down search like "{relational_field}" contains "{value}"
we always need to return the lazy name_get() for each [_]name_search method
closes odoo/odoo#36735
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Diffstat (limited to 'odoo/addons/test_impex')
| -rw-r--r-- | odoo/addons/test_impex/models.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/odoo/addons/test_impex/models.py b/odoo/addons/test_impex/models.py index 353c8223f82..296c4677cc3 100644 --- a/odoo/addons/test_impex/models.py +++ b/odoo/addons/test_impex/models.py @@ -51,7 +51,7 @@ for name, field in MODELS: def _name_search(self, name, args=None, operator='ilike', limit=100, name_get_uid=None): if isinstance(name, str) and name.split(':')[0] == self._name: record_ids = self._search([('value', operator, int(name.split(':')[1]))], access_rights_uid=name_get_uid) - return self.browse(record_ids).name_get() + return models.lazy_name_get(self.browse(record_ids).with_user(name_get_uid)) else: return [] @@ -72,7 +72,7 @@ class One2ManyChild(models.Model): def _name_search(self, name, args=None, operator='ilike', limit=100, name_get_uid=None): if isinstance(name, str) and name.split(':')[0] == self._name: record_ids = self._search([('value', operator, int(name.split(':')[1]))], access_rights_uid=name_get_uid) - return self.browse(record_ids).name_get() + return models.lazy_name_get(self.browse(record_ids).with_user(name_get_uid)) else: return [] @@ -129,7 +129,7 @@ class Many2ManyChild(models.Model): def _name_search(self, name, args=None, operator='ilike', limit=100, name_get_uid=None): if isinstance(name, str) and name.split(':')[0] == self._name: record_ids = self._search([('value', operator, int(name.split(':')[1]))], access_rights_uid=name_get_uid) - return self.browse(record_ids).name_get() + return models.lazy_name_get(self.browse(record_ids).with_user(name_get_uid)) else: return [] |
