From 5cf9d55bbce2e7e8b593e2c9cd178b6fc9d32c29 Mon Sep 17 00:00:00 2001 From: oco-odoo Date: Mon, 9 Sep 2019 10:54:11 +0000 Subject: [PATCH] [FIX] account_facturx: retrieve attachments in the right way to create an invoice Before that, we relied on the fact the call to super() assigned the attachment_ids field, which was wrong outside mail.compose.message. Hence, we fix that by directly browsing the attachment. closes odoo/odoo#36552 Signed-off-by: Laurent Smet --- addons/account_facturx/models/account_move.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account_facturx/models/account_move.py b/addons/account_facturx/models/account_move.py index 721865d4d5d..548953beff1 100644 --- a/addons/account_facturx/models/account_move.py +++ b/addons/account_facturx/models/account_move.py @@ -222,7 +222,7 @@ class AccountMove(models.Model): res = super(AccountMove, self).message_post(**kwargs) if 'no_new_invoice' not in self.env.context and len(self) == 1 and self.state == 'draft': - for attachment in res.attachment_ids: + for attachment in self.env['ir.attachment'].browse(kwargs.get('attachment_ids', [])): self._create_invoice_from_attachment(attachment) return res