From 1930a619a01b360ed32a9d3ce4eb74e8439bc81b Mon Sep 17 00:00:00 2001 From: "Nasreddin Boulif (bon)" Date: Thu, 12 May 2022 10:44:20 +0000 Subject: [PATCH] [FIX] account_edi: enable to parse XML facturx in mail MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue: When receiving a mail with a facturx XML file as attachment, the datas in the XML files are not parsed. Cause: For security reason, if a mail attachment is a XML file, it will be saved as plain text and therefore not be parsed. Solution: If attachment mimetype is `plain/text` and content starts with ` --- addons/account_edi/models/account_edi_format.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/account_edi/models/account_edi_format.py b/addons/account_edi/models/account_edi_format.py index b947cc544c7..975f7859148 100644 --- a/addons/account_edi/models/account_edi_format.py +++ b/addons/account_edi/models/account_edi_format.py @@ -385,9 +385,12 @@ class AccountEdiFormat(models.Model): content = base64.b64decode(attachment.with_context(bin_size=False).datas) to_process = [] + # XML attachments received by mail have a 'text/plain' mimetype. + # Therefore, if content start with '