diff options
| author | Raphael Collet <rco@odoo.com> | 2019-08-14 07:35:49 +0000 |
|---|---|---|
| committer | Denis Ledoux <dle@odoo.com> | 2019-08-20 12:43:59 +0000 |
| commit | 9920f20e4c7753bc17bea71dea3a90f7de687196 (patch) | |
| tree | 6a3d0258c10a8ccb1d85949ddafdeb070de78121 /odoo/modules/loading.py | |
| parent | e28d3aa4d3851d72deba08c236072d002f83216a (diff) | |
[IMP] models: ORM speedup
This branch is the combination of several optimizations in the ORM:
* store field values once in the cache: the cache reflects more
faithfully the database, only fields that explicitly depend on the
context have an extra indirection in the cache;
* delay recomputations by default: use method `recompute` to explicitly
flush out pending recomputations;
* delay updates in method `write`: updates are stored in a data
structure that can be flushed efficiently to the database with method
`flush` (which also flush out recomputations);
* make method `modified` take advantage of inverse fields to inverse
dependencies;
* filter records by evaluating a domain on records in Python;
* a computed field with `readonly=False` behaves like a normal field
with an onchange method;
* computed fields are computed in superuser mode by default.
Work done by Toufik Ben Jaa, Raphael Collet, Denis Ledoux and Fabien
Pinckaers.
closes odoo/odoo#35659
Signed-off-by: Denis Ledoux <beledouxdenis@users.noreply.github.com>
Diffstat (limited to 'odoo/modules/loading.py')
| -rw-r--r-- | odoo/modules/loading.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/odoo/modules/loading.py b/odoo/modules/loading.py index bc423861c90..1551bdc3800 100644 --- a/odoo/modules/loading.py +++ b/odoo/modules/loading.py @@ -268,6 +268,7 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, for kind in ('init', 'demo', 'update'): if hasattr(package, kind): delattr(package, kind) + module.flush() if package.name is not None: registry._init_modules.add(package.name) @@ -391,7 +392,7 @@ def load_modules(db, force_demo=False, status=None, update_module=False): cr.execute("update ir_module_module set state=%s where name=%s", ('installed', 'base')) Module.invalidate_cache(['state']) - + Module.flush() # STEP 3: Load marked modules (skipping base which was done in STEP 1) # IMPORTANT: this is done in two parts, first loading all installed or @@ -451,6 +452,7 @@ def load_modules(db, force_demo=False, status=None, update_module=False): # Cleanup orphan records env['ir.model.data']._process_end(processed_modules) + env['base'].flush() for kind in ('init', 'demo', 'update'): tools.config[kind] = {} @@ -513,6 +515,7 @@ def load_modules(db, force_demo=False, status=None, update_module=False): env = api.Environment(cr, SUPERUSER_ID, {}) for model in env.values(): model._register_hook() + env['base'].flush() # STEP 9: save installed/updated modules for post-install tests registry.updated_modules += processed_modules |
