f243b71dcb9c6910c373c6506c7ff23a2663f0ad
This patch speeds up the performance of method `onchange`. Our use-case is an invoice with 300 lines, where we modify the unit price or quantity on several lines. Each modification triggers a call to `onchange` on the invoice itself. The latter call went from 1.3 to 0.8 seconds, which represents a speedup of 30% to 40%. In the implementation of `onchange`, the first snapshot is preceded by a "prefetching" phase, where the lines of x2many fields are read, so that the fields of unmodified lines are in cache. This is useful because the fields of those lines are not sent by the client, which only sends ids. This prefetching represents more than 40% of the duration of `onchange`, in our use-case. The prefetching is inefficient for several reasons. First, it uses `mapped`, which formats data that is actually never used. Second, it accesses new records that have the actual lines as origin. And on those records, computed stored fields are not taken from the origin record, but are (uselessly) computed instead. We have optimized the prefetching in the following way. It now reads stored fields on the actual lines (using `_read` to avoid formatting), then copies the cache of those fields on the corresponding new lines (to avoid useless computations). This makes the prefetching about 10 times faster! closes odoo/odoo#59781 X-original-commit: ec50c426d7c2a17c7b72e64adab65eda6328e163 Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Odoo
Odoo is a suite of web based open source business apps.
The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...
Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.
Getting started with Odoo
For a standard installation please follow the Setup instructions from the documentation.
To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials
Languages
Python
49.6%
JavaScript
47.8%
SCSS
2%
CSS
0.3%
HTML
0.2%