From 4544b4642f33660e79ffdfe1f541b85b2049e022 Mon Sep 17 00:00:00 2001 From: Yosua Nicolaus Date: Tue, 23 Jan 2024 10:21:37 +0100 Subject: [PATCH] [FIX] l10n_ro_edi: CIUS-RO DocumentTypeCode rule In one of the schematron rules for CIUS-RO, there is a rule for DocumentTypeCode element in the XML that failed the validity test. ` [UBL-SR-43]-Scheme identifier shall only be used for invoiced object (document type code with value 130) ` This commit fixes the current behavior by applying this behavior: - DocumentTypeCode won't show up when exporting Invoice XML - DocumentTypeCode will show up with the value '50' when exporting CreditNote XML closes odoo/odoo#150613 Task-id: 3649426 Signed-off-by: Brice Bartoletti (bib) --- addons/l10n_ro_edi/models/account_edi_xml_ubl_ciusro.py | 4 ++-- .../tests/test_files/from_odoo/ciusro_out_invoice.xml | 1 - .../from_odoo/ciusro_out_invoice_different_currency.xml | 1 - .../tests/test_files/from_odoo/ciusro_out_refund.xml | 2 +- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/addons/l10n_ro_edi/models/account_edi_xml_ubl_ciusro.py b/addons/l10n_ro_edi/models/account_edi_xml_ubl_ciusro.py index a04aedc026b..7543201171c 100644 --- a/addons/l10n_ro_edi/models/account_edi_xml_ubl_ciusro.py +++ b/addons/l10n_ro_edi/models/account_edi_xml_ubl_ciusro.py @@ -74,9 +74,9 @@ class AccountEdiXmlUBLRO(models.AbstractModel): def _get_document_type_code_vals(self, invoice, invoice_data): # EXTENDS 'account_edi_ubl_cii - # http://www.datypic.com/sc/ubl20/e-cbc_DocumentTypeCode.html vals = super()._get_document_type_code_vals(invoice, invoice_data) - vals['value'] = "380" if invoice.move_type == 'out_invoice' else "381" + # [UBL-SR-43] DocumentTypeCode should only show up on a CreditNote XML with the value '50' + vals['value'] = '50' if invoice.move_type == 'out_refund' else False return vals def _export_invoice_constraints(self, invoice, vals): diff --git a/addons/l10n_ro_edi/tests/test_files/from_odoo/ciusro_out_invoice.xml b/addons/l10n_ro_edi/tests/test_files/from_odoo/ciusro_out_invoice.xml index 6185123139e..685eb1d0f82 100644 --- a/addons/l10n_ro_edi/tests/test_files/from_odoo/ciusro_out_invoice.xml +++ b/addons/l10n_ro_edi/tests/test_files/from_odoo/ciusro_out_invoice.xml @@ -15,7 +15,6 @@ INV_2017_00001.pdf - 380 ___ignore___ diff --git a/addons/l10n_ro_edi/tests/test_files/from_odoo/ciusro_out_invoice_different_currency.xml b/addons/l10n_ro_edi/tests/test_files/from_odoo/ciusro_out_invoice_different_currency.xml index c2c48a03174..32d7a9d1c4b 100644 --- a/addons/l10n_ro_edi/tests/test_files/from_odoo/ciusro_out_invoice_different_currency.xml +++ b/addons/l10n_ro_edi/tests/test_files/from_odoo/ciusro_out_invoice_different_currency.xml @@ -15,7 +15,6 @@ INV_2017_00001.pdf - 380 ___ignore___ diff --git a/addons/l10n_ro_edi/tests/test_files/from_odoo/ciusro_out_refund.xml b/addons/l10n_ro_edi/tests/test_files/from_odoo/ciusro_out_refund.xml index df2c566dc8c..2095d2d4e08 100644 --- a/addons/l10n_ro_edi/tests/test_files/from_odoo/ciusro_out_refund.xml +++ b/addons/l10n_ro_edi/tests/test_files/from_odoo/ciusro_out_refund.xml @@ -14,7 +14,7 @@ RINV_2017_00001.pdf - 381 + 50 ___ignore___