Skip to content
Permalink
Browse files

[FIX] mail: set message_main_attachment_id to copy=False

Create a record.
Add an attachment set as message_main_attachment_id (e.g. through log note).
Duplicate that record.
The new record has the message_main_attachment_id of the old record,
while it has no attachments.

Since attachments security is linked to the record id, we shall not copy them.

opw 1950403

closes #31846

Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
  • Loading branch information...
len-odoo committed Mar 14, 2019
1 parent ac4ef45 commit c68a97a255b86af03625bdfc9697e7199efa35e8
Showing with 1 addition and 1 deletion.
  1. +1 −1 addons/mail/models/mail_thread.py
@@ -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', index=True)
message_main_attachment_id = fields.Many2one(string="Main Attachment", comodel_name='ir.attachment', index=True, copy=False)

@api.one
@api.depends('message_follower_ids')

0 comments on commit c68a97a

Please sign in to comment.
You can’t perform that action at this time.