[18.0][IMP] l10n_it_edi_extension: batch-write EDI amount fields on import#5192
Open
micheledic wants to merge 1 commit into
Open
[18.0][IMP] l10n_it_edi_extension: batch-write EDI amount fields on import#5192micheledic wants to merge 1 commit into
micheledic wants to merge 1 commit into
Conversation
eaf5af9 to
7ca81b0
Compare
…mport
Replace the per-iteration "self.l10n_it_edi_amount_untaxed += ..." and
"self.l10n_it_edi_amount_tax += ..." accumulation loops in
_l10n_it_edi_get_extra_info with two sum() expressions and a single
write({...}) executed under skip_invoice_sync=True.
Each += on a stored Monetary field rescheduled the recompute chain of
its dependents (l10n_it_edi_amount_total, l10n_it_edi_validation_message)
N+M times, making XML parsing O(N) for very large invoices.
Benchmark on a clean DB (200 lines, 10 summaries -> 16x; 500 -> 30x;
1000 -> 38x). Behaviour and final field values are unchanged.
7ca81b0 to
3cb72b8
Compare
Contributor
Author
|
@OCA/local-italy-maintainers potete dare un check ? |
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.
Problem
_l10n_it_edi_get_extra_inforuns two+=loops on stored Monetaryfields
l10n_it_edi_amount_untaxedandl10n_it_edi_amount_tax: oneiteration per
DettaglioLinee, one perDatiRiepilogo. Every iterationgoes through
account.move.write()and reschedules dependent recomputes.Total work scales with N+M per invoice.
Fix
Replace both loops with two
sum()calls and onewrite({...})underskip_invoice_sync=True. Final field values match the previous code.Performance (clean DB, in-process bench, min of 3 runs)