summaryrefslogtreecommitdiff
path: root/odoo/modules
diff options
context:
space:
mode:
authorRaphael Collet <rco@odoo.com>2020-04-02 06:45:54 +0000
committerRaphael Collet <rco@odoo.com>2020-04-03 11:40:29 +0000
commit9afce4805fc8bac45fdba817488aa867fddff69b (patch)
tree665f109f3f9881b7e2e0d56caf1a7d9e5aaf9219 /odoo/modules
parent6eb7d5c6a07f678e1d1adca7137652e0626ea17e (diff)
[IMP] core: reflect models, fields and selections in batch
This saves 4.5% of the total installation time. X-original-commit: 8519064dce975af542ccd30dc14c56b9bb36d07b
Diffstat (limited to 'odoo/modules')
-rw-r--r--odoo/modules/registry.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/odoo/modules/registry.py b/odoo/modules/registry.py
index 4e1fe137eb5..02d1cd6e94a 100644
--- a/odoo/modules/registry.py
+++ b/odoo/modules/registry.py
@@ -358,6 +358,9 @@ class Registry(Mapping):
- ``module``: the name of the module being installed/updated, if any;
- ``update_custom_fields``: whether custom fields should be updated.
"""
+ if not model_names:
+ return
+
if 'module' in context:
_logger.info('module %s: creating or updating database tables', context['module'])
elif context.get('models_to_check', False):
@@ -375,6 +378,11 @@ class Registry(Mapping):
model._auto_init()
model.init()
+ env['ir.model']._reflect_models(model_names)
+ env['ir.model.fields']._reflect_fields(model_names)
+ env['ir.model.fields.selection']._reflect_selections(model_names)
+ env['ir.model.constraint']._reflect_constraints(model_names)
+
self._ordinary_tables = None
while self._post_init_queue: