[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.
`
<rule context="cac:AdditionalDocumentReference">
<assert id="UBL-SR-43" flag="fatal" test="((cbc:DocumentTypeCode='130') or
((local-name(/*) = 'CreditNote') and (cbc:DocumentTypeCode='50')) or
(not(cbc:ID/@scheme) and not(cbc:DocumentTypeCode)))">
[UBL-SR-43]-Scheme identifier shall only be used for invoiced object
(document type code with value 130)
</assert>
</rule>
`
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) <bib@odoo.com>
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
</cac:OrderReference>
|
||||
<cac:AdditionalDocumentReference>
|
||||
<cbc:ID>INV_2017_00001.pdf</cbc:ID>
|
||||
<cbc:DocumentTypeCode>380</cbc:DocumentTypeCode>
|
||||
<cac:Attachment>
|
||||
<cbc:EmbeddedDocumentBinaryObject mimeCode="application/pdf" filename="INV_2017_00001.pdf">___ignore___</cbc:EmbeddedDocumentBinaryObject>
|
||||
</cac:Attachment>
|
||||
|
||||
-1
@@ -15,7 +15,6 @@
|
||||
</cac:OrderReference>
|
||||
<cac:AdditionalDocumentReference>
|
||||
<cbc:ID>INV_2017_00001.pdf</cbc:ID>
|
||||
<cbc:DocumentTypeCode>380</cbc:DocumentTypeCode>
|
||||
<cac:Attachment>
|
||||
<cbc:EmbeddedDocumentBinaryObject mimeCode="application/pdf" filename="INV_2017_00001.pdf">___ignore___</cbc:EmbeddedDocumentBinaryObject>
|
||||
</cac:Attachment>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
</cac:OrderReference>
|
||||
<cac:AdditionalDocumentReference xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2">
|
||||
<cbc:ID>RINV_2017_00001.pdf</cbc:ID>
|
||||
<cbc:DocumentTypeCode>381</cbc:DocumentTypeCode>
|
||||
<cbc:DocumentTypeCode>50</cbc:DocumentTypeCode>
|
||||
<cac:Attachment>
|
||||
<cbc:EmbeddedDocumentBinaryObject mimeCode="application/pdf" filename="RINV_2017_00001.pdf">___ignore___</cbc:EmbeddedDocumentBinaryObject>
|
||||
</cac:Attachment>
|
||||
|
||||
Reference in New Issue
Block a user