[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) <las@odoo.com>
This commit is contained in:
Anh Thao Pham (pta)
2024-03-11 15:03:02 +00:00
parent 0db66b3835
commit 3ab2d52b1f
@@ -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({