[17.0][FIX] account_invoice_facturx: fix Factur-X 4.x schematron errors#1320
Open
[17.0][FIX] account_invoice_facturx: fix Factur-X 4.x schematron errors#1320
Conversation
Prevent Factur-X invoices from failing schematron validation with factur-x 4.x. The generated XML must stay compliant with newer validation rules, otherwise valid Odoo invoices cannot be exported as Factur-X documents. This change removes the invalid email URI attribute, exports a proprietary account identifier when IBAN is not available, and updates tests to cover the new compliant output and the missing-account error. Task: 5347
Contributor
|
Hi @alexis-via, |
Some invoices already have a delivery/service date on the Odoo side, but this date was not exported to the generated Factur-X XML. As a result, the XML could fail validation because neither a header delivery date nor a billing period was present. This patch adds the delivery date to the header trade delivery block by exporting `ActualDeliverySupplyChainEvent/OccurrenceDateTime`, using the invoice date as the default delivery/service date. The XML node order is also kept XSD-compliant. Task: 5347
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With factur-x 4.x, schematron validation became stricter and the module
started generating EN16931 XML that no longer passed validation for
credit transfer invoices.
Two concrete problems caused that failure:
URIID, although this attribute is not allowed in that context;
a fallback account identifier, so the payment means block failed
BR-CO-27.
As a result, invoices that were previously generated successfully with
factur-x 3.x started failing during Factur-X XML generation with
factur-x 4.x.
This patch fixes the XML generation logic by:
instead of generating XML that is known to be invalid.
The test suite is updated accordingly:
ProprietaryID;
explicitly.
Task: 5347