diff --git a/addons/account_edi_ubl_cii/models/account_edi_xml_cii_facturx.py b/addons/account_edi_ubl_cii/models/account_edi_xml_cii_facturx.py index 61899e0c3b6..ca9a3d988d6 100644 --- a/addons/account_edi_ubl_cii/models/account_edi_xml_cii_facturx.py +++ b/addons/account_edi_ubl_cii/models/account_edi_xml_cii_facturx.py @@ -236,8 +236,7 @@ class AccountEdiXmlCII(models.AbstractModel): vals = self._export_invoice_vals(invoice) errors = [constraint for constraint in self._export_invoice_constraints(invoice, vals).values() if constraint] xml_content = self.env['ir.qweb']._render('account_edi_ubl_cii.account_invoice_facturx_export_22', vals) - xml_content = b"\n" + etree.tostring(cleanup_xml_node(xml_content)) - return xml_content, set(errors) + return etree.tostring(cleanup_xml_node(xml_content), xml_declaration=True, encoding='UTF-8'), set(errors) # ------------------------------------------------------------------------- # IMPORT diff --git a/addons/account_edi_ubl_cii/models/account_edi_xml_ubl_20.py b/addons/account_edi_ubl_cii/models/account_edi_xml_ubl_20.py index 164a34598fc..23104de23ca 100644 --- a/addons/account_edi_ubl_cii/models/account_edi_xml_ubl_20.py +++ b/addons/account_edi_ubl_cii/models/account_edi_xml_ubl_20.py @@ -478,8 +478,7 @@ class AccountEdiXmlUBL20(models.AbstractModel): vals = self._export_invoice_vals(invoice) errors = [constraint for constraint in self._export_invoice_constraints(invoice, vals).values() if constraint] xml_content = self.env['ir.qweb']._render(vals['main_template'], vals) - xml_content = b"\n" + etree.tostring(cleanup_xml_node(xml_content)) - return xml_content, set(errors) + return etree.tostring(cleanup_xml_node(xml_content), xml_declaration=True, encoding='UTF-8'), set(errors) # ------------------------------------------------------------------------- # IMPORT diff --git a/addons/account_edi_ubl_cii/models/account_move_send.py b/addons/account_edi_ubl_cii/models/account_move_send.py index f967b3f5080..2fedd367d7c 100644 --- a/addons/account_edi_ubl_cii/models/account_move_send.py +++ b/addons/account_edi_ubl_cii/models/account_move_send.py @@ -216,8 +216,9 @@ class AccountMoveSend(models.Model): anchor_index = tree.index(anchor_elements[0]) tree.insert(anchor_index, etree.fromstring(to_inject)) - invoice_data['ubl_cii_xml_attachment_values']['raw'] = b"\n" \ - + etree.tostring(cleanup_xml_node(tree)) + invoice_data['ubl_cii_xml_attachment_values']['raw'] = etree.tostring( + cleanup_xml_node(tree), xml_declaration=True, encoding='UTF-8' + ) def _link_invoice_documents(self, invoice, invoice_data): # EXTENDS 'account'