From a442fdc833873ba80e400f6898454289e0dc3d1b Mon Sep 17 00:00:00 2001 From: "Dylan Kiss (dyki)" Date: Mon, 11 Sep 2023 16:05:51 +0200 Subject: [PATCH] [IMP] account_edi_ubl_cii: always set customer reference For PEPPOL, the Customer Reference field on invoices is a required field. In Odoo it can be blank when creating an invoice from scratch. In order to avoid errors when sending PEPPOL invoices, we want to set the Customer Reference to the invoice name when no reference was provided. task-3499548 closes odoo/odoo#135158 Signed-off-by: Laurent Smet (las) --- addons/account_edi_ubl_cii/models/account_edi_xml_ubl_20.py | 2 +- addons/l10n_sa_edi/tests/compliance/simplified/invoice.xml | 3 +++ addons/l10n_sa_edi/tests/compliance/standard/invoice.xml | 3 +++ 3 files changed, 7 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 06de9681cef..a4a4698822f 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 @@ -491,7 +491,7 @@ class AccountEdiXmlUBL20(models.AbstractModel): sales_order_id = 'sale_line_ids' in invoice.invoice_line_ids._fields \ and ",".join(invoice.invoice_line_ids.sale_line_ids.order_id.mapped('name')) # OrderReference/ID (order_reference) is mandatory inside the OrderReference node ! - order_reference = invoice.ref or invoice.name if sales_order_id else invoice.ref + order_reference = invoice.ref or invoice.name vals = { 'builder': self, diff --git a/addons/l10n_sa_edi/tests/compliance/simplified/invoice.xml b/addons/l10n_sa_edi/tests/compliance/simplified/invoice.xml index 4a0ed4d07ca..42918ffc799 100644 --- a/addons/l10n_sa_edi/tests/compliance/simplified/invoice.xml +++ b/addons/l10n_sa_edi/tests/compliance/simplified/invoice.xml @@ -9,6 +9,9 @@ SAR SAR Mohammed Ali + + INV/2023/00034 + QR diff --git a/addons/l10n_sa_edi/tests/compliance/standard/invoice.xml b/addons/l10n_sa_edi/tests/compliance/standard/invoice.xml index a34768f15e7..165a0d1eaa1 100644 --- a/addons/l10n_sa_edi/tests/compliance/standard/invoice.xml +++ b/addons/l10n_sa_edi/tests/compliance/standard/invoice.xml @@ -12,6 +12,9 @@ SAR SAR Azure Interior + + INV/2022/00014 + PIH