Wednesday, January 24, 2024
4 changes · 17.0
Enhancements to existing features
P&L reports that group by analytic accounts or plans are now significantly faster. The update adds a database index to the temporary table used for analytic reporting, reducing report generation time by up to 90% (from 21 seconds to 2.1 seconds for large datasets). This improvement makes financial reporting more responsive for users working with detailed analytic data.
Original PR description
## Description Opening a P&L report and doing some grouping by an analytic account or an analytic plan can be extremely slow. This is due to the fact that, in the goal of reusing the generic report…
## Description Opening a P&L report and doing some grouping by an analytic account or an analytic plan can be extremely slow. This is due to the fact that, in the goal of reusing the generic report engine, which is based on `account.move.line`, a temporary table is created that shadows said table, but overwrite the data with content from `account.analytic.line` instead. The temporary table has absolutely no indexes, therefor forcing a Seq.Scan for all queries done on the table. As the `account.analytic.line` model can grow quite large in general, sequential scans on that table quickly becomes slow. ## Fix We introduce 1 composite index on the temporary table to speed up the subsequent queries on it. This slows down the initial creation of the temporary table, at the benefit of significantly speeding up all report sections queries, which are done for each `account_type`. Since the temporary table has no traffic on it, the exclusive lock on the table for the index creation is immediately acquired, so the time taken to build the index is proportional to the size of the table. The index is dropped when the temporary table is dropped. ## Benchmark Durations of the request `get_report_informations` for a P&L report of the last fiscal year, all journals, and grouping by 1 analytic plan of a database with a bit above 200k AAL: | AAL Volume | Before | After | |------------|--------|-------| | 50k | 4.75s | 1s | | 100k | 9s | 1.4s | | 200k | 21s | 2.1s | (in the last line, the 2.1s -> 1.2s is for the index creation + analyze) Scaling is also better when it comes to grouping by more analytic accounts or plans. ## Reference opw-3659497 Community PR: https://github.com/odoo/odoo/pull/148490 Forward-Port-Of: odoo/enterprise#53817
Resolved issues and error corrections
This fix resolves a performance issue in the General Ledger report where clicking "Unfold All" would load all lines at once, causing browser slowdowns or freezes on large databases. The system now properly applies the load limit (80 lines by default) to prevent overwhelming the browser with too many elements to render at once.
Original PR description
Before this fix, when clicking "Unfold All" on the General Ledger, the "Load More Limit" assigned to the report (80 by default) was not applied, and all the lines were always loaded in the UI. This caused performance issues on large databases, where the high number of move lines do display can overload the browser, slow it down a lot, or even freeze it (due to the high number of elements needing to be rendered). This was due to the fact the General Ledger's _custom_batch_data_generator needed to filter the additional elements it loads. We cannot filter directly in SQL because we get everything in a single batched query, but we can restrict the number of elements we return after getting them from the db. OPW 3672271 Forward-Port-Of: odoo/enterprise#54664 Forward-Port-Of: odoo/enterprise#54384
This fix addresses a critical accounting discrepancy that occurred when changing a product's inventory valuation method. Previously, when a product's category was changed from manual to real-time valuation after creating inventory adjustments, the system would show mismatched values between inventory and accounting records (a 60€ difference in the example). This fix reverts a previous change that introduced this issue, ensuring accurate financial reporting.
Original PR description
This reverts commit 652edc38527b14995f017d514053a57825091813. It creates a new issue with valuation change. Steps to reproduce: -Create a new product with a cost of 10 (std, manual) -Create an inventory adjustment to set the quantity to -3 -Change the product's category to real-time -Now the valuation for this product is -30€, but the accounting part has 30€, creating a difference of 60€." A better solution to fix both issues has been tried but it was far from optimal. Since it's an edge usecase we will not support it until master Description of the issue/feature this PR addresses: Current behavior before PR: Desired behavior after PR is merged: --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#149053 Forward-Port-Of: odoo/odoo#147949
This fix resolves a crash that occurs in the email marketing editor when users save content containing text or comment nodes within card blocks. The issue affected users creating email templates with the Comparisons block (version 15.0) or Event block (version 16.0+). The fix ensures the editor properly handles all types of content nodes without crashing during the save process.
Original PR description
__Current behavior before commit:__ If `child` is not an `Element` (like a Text or a Comment node), the call to `querySelectorAll` at the following line will crash. __Description of the fix:__ End the current loop iteration if `child` is not an `Element` to avoid calling `querySelectorAll` on it. __Steps to reproduce the issue on runbot:__ In 15.0: - Open Email Marketing > Mailings > Create > Second template - Drag and drop a `Comparisons` block - Display source code - Write some text under the `<div class="card ...">` - Save --> Traceback In 16.0+: - Open Email Marketing > Mailings > New > `Start From Scratch` - Drag and drop an `Event` block - Replace one of the image (a comment node will be added [here][1]) - Save --> Traceback opw-3682469 opw-3689181 [1]: https://github.com/odoo/odoo/blob/df1b43a6de5ad15a8fee3713de7d8ec926c61f12/addons/web_editor/static/src/js/backend/convert_inline.js#L715 Forward-Port-Of: odoo/odoo#150096