Skip to content

[17.0][FIX] account_invoice_facturx: fix Factur-X 4.x schematron errors#1320

Open
tendil wants to merge 2 commits intoOCA:17.0from
cetmix:17.0-t5347-account_invoice_facturx-fix_factur_4_validation
Open

[17.0][FIX] account_invoice_facturx: fix Factur-X 4.x schematron errors#1320
tendil wants to merge 2 commits intoOCA:17.0from
cetmix:17.0-t5347-account_invoice_facturx-fix_factur_4_validation

Conversation

@tendil
Copy link
Copy Markdown

@tendil tendil commented Apr 8, 2026

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:

  • the seller contact email was exported with a schemeID attribute on
    URIID, although this attribute is not allowed in that context;
  • when the creditor account was not an IBAN, the module did not export
    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:

  • removing the invalid schemeID attribute from the seller email URIID;
  • exporting ProprietaryID for non-IBAN creditor accounts;
  • raising a clear UserError when no account identifier is available,
    instead of generating XML that is known to be invalid.

The test suite is updated accordingly:

  • the default invoice fixture now includes a valid creditor account;
  • a regression test checks that URIID is generated without schemeID;
  • a regression test checks that non-IBAN accounts are exported as
    ProprietaryID;
  • a regression test checks that missing account identifiers are rejected
    explicitly.

Task: 5347

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
@OCA-git-bot
Copy link
Copy Markdown
Contributor

Hi @alexis-via,
some modules you are maintaining are being modified, check this out!

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants