From 4cdd9a0d86d466f200dddd52bca8f48449834f82 Mon Sep 17 00:00:00 2001 From: Julien Van Roy Date: Fri, 8 Jul 2022 13:50:42 +0000 Subject: [PATCH] [FIX] account_edi_ubl_cii: fix embedding of pdf in xml The embedding of the pdf inside the xml should only take place for a defined list of EDI formats (bis 3, ubl_de, nlcius), not for all. Otherwise, we get unexpected behaviours when generating other EDI's xml (e.g. l10n_pe_edi). closes odoo/odoo#95795 X-original-commit: 75a87bc7fa1f3331efe2048bb949e3426df2dc57 Signed-off-by: Josse Colpaert Signed-off-by: Julien Van Roy --- addons/account_edi_ubl_cii/models/ir_actions_report.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/account_edi_ubl_cii/models/ir_actions_report.py b/addons/account_edi_ubl_cii/models/ir_actions_report.py index 64be3af22fa..d0a49e07966 100644 --- a/addons/account_edi_ubl_cii/models/ir_actions_report.py +++ b/addons/account_edi_ubl_cii/models/ir_actions_report.py @@ -13,7 +13,10 @@ class IrActionsReport(models.Model): _inherit = 'ir.actions.report' def _add_pdf_into_invoice_xml(self, invoice, stream_data): - for edi_attachment in invoice.edi_document_ids.attachment_id: + # exclude efff because it's handled by l10n_be_edi + format_codes = ['ubl_bis3', 'ubl_de', 'nlcius_1'] + edi_attachments = invoice.edi_document_ids.filtered(lambda d: d.edi_format_id.code in format_codes).attachment_id + for edi_attachment in edi_attachments: old_xml = base64.b64decode(edi_attachment.with_context(bin_size=False).datas, validate=True) tree = etree.fromstring(old_xml) anchor_elements = tree.xpath("//*[local-name()='AccountingSupplierParty']")