[FIX] mail: lessen recompute on res.company model

'email_formatted' on 'res.company' model depends on its formatted catchall
and its underlying partner formatted email. However we do not need to
give 'partner.id.email_formatted' trigger in the compute methods as it is
not stored and thus do not need to recompute it for every change of linked
partners in DB; it is valid for the current transaction. It allows to lessen
invalidation of computed fields.

Task-3557985 (Mail: Message cleanup (shortcode, link))
Prepares Task-36879 (Mail: Support MultiCompany Aliases)

Part-of: odoo/odoo#138938
This commit is contained in:
Thibault Delavallée
2023-10-18 07:51:43 +00:00
parent 7bd5bc9969
commit f6ca054238
+1 -1
View File
@@ -36,7 +36,7 @@ class Company(models.Model):
company.catchall_email = ''
company.catchall_formatted = ''
@api.depends('partner_id.email_formatted', 'catchall_formatted')
@api.depends('partner_id', 'catchall_formatted')
def _compute_email_formatted(self):
for company in self:
if company.partner_id.email_formatted: