Monday, April 22, 2024
1 change · 17.0
Enhancements to existing features
This update significantly speeds up the process of validating invoices with deferred expense lines. By optimizing how the system processes multiple deferred entries, validation times are reduced by 44-81% depending on the number of lines, making it much faster to process complex invoices with deferred accounting items.
Original PR description
## Description Validating invoices that have a lot of lines that needs to be deferred is taking extremely long time. Most of the bottleneck is from `_generate_deferred_entries`. We've batched some of the ORM calls to avoid repetitive calls to slow methods in `account_move` like `create`, `__set__`, `_post`. ## Benchmark Tested on a saas-16.4 DB: validating an invoice with deferred lines generating on average 12 periods per line | Lines | Before (Timing / Queries) | After (Timing / Queries) | % Speed up | |-------|-------------------------------|--------------------------|------------| | 50 | 1 min / 23216 | 33.4 sec / 16713 | 44.3% | | 100 | 3 min / 46736 | 1.3 min / 33557 | 56.7% | | 230 | 17.7 min (timed-out) / 111196 | 3.4 min / 79777 | 80.7% | ## Reference opw-3815242 Forward-Port-Of: odoo/enterprise#59448