[FIX] mail: add index on message_main_attachment_id
- When deleting attachments, the foreign key constraints on `message_main_attachment_id` are triggered which could take a lot of time to be computed. closes odoo/odoo#28358
This commit is contained in:
@@ -110,7 +110,7 @@ class MailThread(models.AbstractModel):
|
||||
'Number of error', compute='_compute_message_has_error',
|
||||
help="Number of messages with delivery error")
|
||||
message_attachment_count = fields.Integer('Attachment Count', compute='_compute_message_attachment_count')
|
||||
message_main_attachment_id = fields.Many2one(string="Main Attachment", comodel_name='ir.attachment')
|
||||
message_main_attachment_id = fields.Many2one(string="Main Attachment", comodel_name='ir.attachment', index=True)
|
||||
|
||||
@api.one
|
||||
@api.depends('message_follower_ids')
|
||||
|
||||
Reference in New Issue
Block a user