[18.0][FIX] l10n_fr_einvoicing: don't recompute the whole history when the issuer's entity type is set - #37
Closed
njeudy wants to merge 1 commit into
Closed
Conversation
… type change
fr_einvoicing_required is stored and depends on
fr_directory_company_entity_type, a related on
company_id.partner_id.fr_directory_entity_type. One value therefore drives the
field on every invoice of the company: setting the issuer's entity type — a
one-off, done through the Directory Sync button when the reform is switched on
— invalidates the entire history in a single transaction.
On a production-sized database (877k journal entries, 497k customer invoices)
the worker dies before writing anything:
File "l10n_fr_einvoicing/models/account_move.py", in _compute_einvoicing_required
move.move_type in ("out_invoice", "out_refund")
MemoryError
Drop that dependency and recompute explicitly, in committed batches, through
_fr_ctc_recompute_einvoicing_required(). This mirrors what the module already
does for company_fr_directory_line_id, which depends only on company_id and
has _fr_ctc_compute_invoice_company_dir_line() to refresh it — including the
hard_lock_date filter, which keeps locked years out of the way.
Closes akretion#36
|
Hi @alexis-via, |
This was referenced Jul 30, 2026
Contributor
Author
|
Superseded by 6f74991 on For anyone landing here from #36: the symptom was a |
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 #36.
Setting the entity type on the issuer's partner — the first step of the onboarding, via Directory Sync — currently recomputes
fr_einvoicing_requiredon every invoice of the company in a single transaction, and dies inMemoryErroron any real history. Details, traceback and reasoning in #36.What changes
fr_directory_company_entity_typeis dropped from the@api.dependsof_compute_einvoicing_required: it is a related on the company's partner, so one value was driving a stored field on the whole company.The refresh becomes explicit and batched, in
res_company._fr_ctc_recompute_einvoicing_required(), mirroring what the module already does forcompany_fr_directory_line_idwith_fr_ctc_compute_invoice_company_dir_line()— samehard_lock_datefilter included.The customer-side dependency is untouched: it is bounded by one partner's invoices, and the directory sync walks partners one at a time.
Notes