From f95e49beb0a6332ebd4cc6dd7158f62ae043d6bd Mon Sep 17 00:00:00 2001 From: "Andrea Grazioso (agr-odoo)" Date: Fri, 26 May 2023 13:31:11 +0000 Subject: [PATCH] [FIX] account_edi: multi record send&print With an EDI localization (MX) Create 2+ invoices with edi attachments (xml) In list view, select both and hit actions > send&print Issue: EDI file will not be attached to the mail opw-3330554 closes odoo/odoo#124446 X-original-commit: 9730a9753936f040a987505ed064cfd51acb50e0 Signed-off-by: Grazioso Andrea (agr) Signed-off-by: Laurent Smet --- addons/account_edi/models/account_edi_document.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/account_edi/models/account_edi_document.py b/addons/account_edi/models/account_edi_document.py index 10de7724c3d..f6d97ba869d 100644 --- a/addons/account_edi/models/account_edi_document.py +++ b/addons/account_edi/models/account_edi_document.py @@ -283,4 +283,8 @@ class AccountEdiDocument(models.Model): if not (attachment_sudo.res_model and attachment_sudo.res_id): # do not return system attachment not linked to a record return {} + if len(self._context.get('active_ids', [])) > 1: + # In mass mail mode 'attachments_ids' is removed from template values + # as they should not be rendered + return {'attachments': [(attachment_sudo.name, attachment_sudo.datas)]} return {'attachment_ids': attachment_sudo.ids}