[FIX] base: simplify field dependencies to avoid costly invalidation

Consider upgrading module 'base' on a database with millions of 'res.partner' records.
The upgrade of country and country state data makes a very costly search to reverse
the dependencies of the non-stored computed field 'contact_address', just for the sake
of invalidating its value from cache, which is most probably not present at all.  The
cost of the search is so high that it may prevent from upgrading the module (timeout).

closes odoo/odoo#80251

X-original-commit: b7f9d0b7c3dfbca0f4897a650983a298da811ce1
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
This commit is contained in:
Florent de Labarre
2021-11-23 13:55:01 +00:00
parent e1084c4536
commit 49a23bb3fa
+1 -2
View File
@@ -1024,8 +1024,7 @@ class Partner(models.Model):
def _display_address_depends(self):
# field dependencies of method _display_address()
return self._formatting_address_fields() + [
'country_id.address_format', 'country_id.code', 'country_id.name',
'company_name', 'state_id.code', 'state_id.name',
'country_id', 'company_name', 'state_id',
]
@api.model