From 49a23bb3fadc07564c4a7765995bdac21cbbd564 Mon Sep 17 00:00:00 2001 From: Florent de Labarre Date: Tue, 23 Nov 2021 09:17:55 +0000 Subject: [PATCH] [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) --- odoo/addons/base/models/res_partner.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/odoo/addons/base/models/res_partner.py b/odoo/addons/base/models/res_partner.py index 481db8fde22..ea52c6a91cf 100644 --- a/odoo/addons/base/models/res_partner.py +++ b/odoo/addons/base/models/res_partner.py @@ -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