From 3ab2d52b1fd8e54516502eaa1e6a5e39d0fac0f4 Mon Sep 17 00:00:00 2001 From: "Anh Thao Pham (pta)" Date: Thu, 22 Feb 2024 16:18:53 +0100 Subject: [PATCH] [FIX] account_edi_ubl_cii: allow to override Note format In UBL 2.0, the Note node can contain the narration field of an invoice. Its content can be some complex HTML. Some localization (e.g. l10n_pe) doesn't support some special characters like '\n' or '\u00A0'. This fix allows the localization modules to format the value used by Note node. opw-3744946 closes odoo/odoo#155081 Related: odoo/enterprise#57268 Signed-off-by: Laurent Smet (las) --- addons/account_edi_ubl_cii/models/account_edi_xml_ubl_20.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 15538143c03..91ca469361d 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 @@ -521,7 +521,7 @@ class AccountEdiXmlUBL20(models.AbstractModel): 'id': invoice.name, 'issue_date': invoice.invoice_date, 'due_date': invoice.invoice_date_due, - 'note_vals': [{'note': html2plaintext(invoice.narration)}] if invoice.narration else [], + 'note_vals': self._get_note_vals_list(invoice), 'order_reference': order_reference, 'sales_order_id': sales_order_id, 'accounting_supplier_party_vals': { @@ -565,6 +565,9 @@ class AccountEdiXmlUBL20(models.AbstractModel): return vals + def _get_note_vals_list(self, invoice): + return [{'note': html2plaintext(invoice.narration)}] if invoice.narration else [] + def _export_invoice_constraints(self, invoice, vals): constraints = self._invoice_constraints_common(invoice) constraints.update({