Skip to Content
Menu
This question has been flagged
1 Reply
4966 Views

Hi,

How can i add attachments using message_post method in Odoo 13.

Thanks

Avatar
Discard
Best Answer

Hi,

Try the following code

attachment_ids = fields.Many2many('ir.attachment', 'doc_warning_rel', 'doc_id', 'attach_id4', string="Attachment")

def your_custom_function(self):
attachments = []
for i in self.attachment_ids:
attachments.append(i.id)
self.message_post(body='your message', partner_ids='your partner ids', attachment_ids=attachments)

Regards

Avatar
Discard