-
- Downloads
[IMP] base: optimize create on models with property fields
Before this commit, creating a record of a model with at least one
property/company_dependent field would trigger the field's inverse
method regardless of whether an actual value was being passed in for the
field or not.
This means that if no value was given or if the value was the same
as the default value, we would waste precious time in the property
field's inverse method.
With this commit, we do not call the inverse method if:
1) there is no value for it in the vals dict (use default)
2) the value in the vals dict is the same as the default value
As an example, when creating a res.partner record while having account
installed (which introduces a property field in res.partner), the
creation time goes from 24ms to 14ms.
closes odoo/odoo#36267
Signed-off-by:
Raphael Collet (rco) <rco@openerp.com>
Showing
- odoo/addons/test_performance/models/models.py 16 additions, 0 deletionsodoo/addons/test_performance/models/models.py
- odoo/addons/test_performance/security/ir.model.access.csv 2 additions, 0 deletionsodoo/addons/test_performance/security/ir.model.access.csv
- odoo/addons/test_performance/tests/test_performance.py 75 additions, 1 deletionodoo/addons/test_performance/tests/test_performance.py
- odoo/models.py 9 additions, 0 deletionsodoo/models.py
Loading
Please register or sign in to comment