[18.0][FIX] account_invoice_en16931: only check the EN16931 config of issuing companies - #47
Open
njeudy wants to merge 1 commit into
Open
[18.0][FIX] account_invoice_en16931: only check the EN16931 config of issuing companies#47njeudy wants to merge 1 commit into
njeudy wants to merge 1 commit into
Conversation
|
Hi @alexis-via, |
This was referenced Aug 7, 2026
…ng companies _post() runs the company-level configuration check for every sale document, with no condition. In a multi-company database where a single company is subject to the French reform, installing the module makes all the other companies unable to post customer invoices until their own taxes are UNECE-coded -- including companies in other countries that will never emit an EN16931 document. The document itself is not at risk: _en16931_checks() is also called from _en16931_checks_upon_invoice_generation(), so a company with an incomplete configuration still cannot generate an EN16931 document. The call in _post() only anticipates that error at posting time. Add en16931_issuer on res.company (option 2 of akretion#42), unset by default, that localisation modules may set for the companies they cover, and gate the _post() check on it. The configuration remains verifiable at any time from the accounting settings, through a "Check Configuration" button that runs the same checks on demand. Fixes akretion#42
njeudy
force-pushed
the
18.0-fix-en16931-checks-scope
branch
from
August 8, 2026 18:01
2ef817f to
3a91149
Compare
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.
Fixes #42, reported by @almumu.
_post()runscompany_id._en16931_checks()for every sale document, with no condition. In a multi-company database where a single company is subject to the French reform, installing the module makes all the other companies unable to post customer invoices until their own taxes are UNECE-coded — including companies in other countries that will never emit an EN16931 document.Measured on a clean 19.0 database, whole stack installed, same command before and after: the unconditional check raises
The following errors have been detected in company ... that block EN16931 e-invoicingin 390 standard Odoo tests (account 287, sale 45, account_edi_ubl_cii 18, account_payment 8) — all of them tests that create their own company and post an invoice on it. The full run goes from41 failed, 418 errors of 3902 teststo39 failed, 51 errors of 3976 tests.Two occurrences survive, in
account.tests.test_audit_trail: those reach the check through the generation path, which this patch deliberately leaves unconditional.The document itself is never at risk:
_en16931_checks()is also called from_en16931_checks_upon_invoice_generation(), so a company with an incomplete configuration still cannot generate an EN16931 document. The call in_post()only anticipates that same error at posting time.This implements option 2 of the issue rather than option 1 (removing the call), so that nothing is lost for the companies that do issue:
res.company.en16931_issuer, unset by default, which localisation modules can set for the companies they cover;_post()check is gated on it;Tell us if you'd rather have option 1 — a two-line diff — or a different default for the new field, and we'll adjust.