From 9dcecc0e46ac66edac4636d26c18e8a249b3c7de Mon Sep 17 00:00:00 2001 From: Florent de Labarre <florent.mirieu@gmail.com> Date: Tue, 11 May 2021 14:26:33 +0000 Subject: [PATCH] [FIX] mail: impossible to update image of partner on large database On large database with million of messages made by one partner. When you try to update the image of partner, it take lot of time (CPU time limit). --- addons/mail/models/mail_message.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mail/models/mail_message.py b/addons/mail/models/mail_message.py index 8496a57958e9..453567552598 100644 --- a/addons/mail/models/mail_message.py +++ b/addons/mail/models/mail_message.py @@ -80,7 +80,7 @@ class Message(models.Model): author_id = fields.Many2one( 'res.partner', 'Author', index=True, ondelete='set null', help="Author of the message. If not set, email_from may hold an email address that did not match any partner.") - author_avatar = fields.Binary("Author's avatar", related='author_id.image_128', readonly=False) + author_avatar = fields.Binary("Author's avatar", related='author_id.image_128', depends=['author_id'], readonly=False) # recipients: include inactive partners (they may have been archived after # the message was sent, but they should remain visible in the relation) partner_ids = fields.Many2many('res.partner', string='Recipients', context={'active_test': False}) -- GitLab