跳至內容
選單
此問題已被標幟
1 回覆
5605 瀏覽次數

Hi,

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

Thanks

頭像
捨棄
最佳答案

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

頭像
捨棄