Skip to content
Permalink
Browse files

[IMP] base: avoid name_get when possible

When search on partner_id return thousands of records, thousands of
_name_get are performed, and there's a great chance to not use them at 
all. Using the lazy_name_get seems more efficient in terms of memory and 
cpu.

closes #31075

Signed-off-by: Christophe Simonis <chs@odoo.com>
  • Loading branch information...
nseinlet committed Feb 13, 2019
1 parent fe83f0d commit bae95e303c0c9057c5d44b890cc85ba7b21d8ce2
Showing with 1 addition and 1 deletion.
  1. +1 −1 odoo/addons/base/models/res_partner.py
@@ -720,7 +720,7 @@ def _name_search(self, name, args=None, operator='ilike', limit=100, name_get_ui
partner_ids = [row[0] for row in self.env.cr.fetchall()]

if partner_ids:
return self.browse(partner_ids).name_get()
return models.lazy_name_get(self.browse(partner_ids))
else:
return []
return super(Partner, self)._name_search(name, args, operator=operator, limit=limit, name_get_uid=name_get_uid)

0 comments on commit bae95e3

Please sign in to comment.
You can’t perform that action at this time.