Monday, April 22, 2024
2 changes · 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
Resolved issues and error corrections
Removed an unnecessary Odoo service restart that was occurring when loading the Worldline payment library. This restart was causing duplicate Odoo instances to run simultaneously, leading to system errors like "Address already in use" and potential crashes. The fix ensures the system runs smoothly without these conflicts.
Original PR description
Currently, when downloading/loading Worldline lib at the start of Odoo, after doing so we are restarting Odoo at the end of "load_worldline_library.sh" script. This is unnecessary as Odoo is capable of detecting the terminals and communicating with them straight away when it has the library and the linker set up. More annoyingly, this leads to a very tricky bug: Odoo service is being restarted in a subshell. Since Odoo is already running this 2nd service will be blocked, but as soon as the primary Odoo service stops, the 2nd one takes the lead. So when restarting Odoo we can get error like "Adress already in use", duplicate code executed and even more dangerousely, duplicate C++/C code running with Worldline and Six, which can lead to race conditions and crashes. task-3873045 Forward-Port-Of: odoo/enterprise#60865