diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-07-05 18:53:17 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-07-05 18:53:17 +0200 |
| commit | 2214bffefb26ce033ec145bce9edabacc342fe02 (patch) | |
| tree | 22a90a10cb02ee9f3121122a446470ba23850ac6 /odoo/modules | |
| parent | 4846c30c90abdd32bdc16715892e46ec1797c25c (diff) | |
| parent | 45329c0cf2c5158f7c7ccdae888adbaf2e15e7ca (diff) | |
[MERGE] forward port branch saas-11.2 up to 45329c0cf2c
Diffstat (limited to 'odoo/modules')
| -rw-r--r-- | odoo/modules/loading.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/odoo/modules/loading.py b/odoo/modules/loading.py index b9f4e2fdc7b..6e123324635 100644 --- a/odoo/modules/loading.py +++ b/odoo/modules/loading.py @@ -120,7 +120,17 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, continue _logger.debug('loading module %s (%d/%d)', module_name, index, module_count) - migrations.migrate_module(package, 'pre') + + needs_update = ( + hasattr(package, "init") + or hasattr(package, "update") + or package.state in ("to install", "to upgrade") + ) + if needs_update: + if package.name != 'base': + registry.setup_models(cr) + migrations.migrate_module(package, 'pre') + load_openerp_module(package.name) new_install = package.state == 'to install' @@ -133,8 +143,7 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, model_names = registry.load(cr, package) loaded_modules.append(package.name) - if (hasattr(package, 'init') or hasattr(package, 'update') - or package.state in ('to install', 'to upgrade')): + if needs_update: models_updated |= set(model_names) models_to_check -= set(model_names) registry.setup_models(cr) @@ -154,7 +163,7 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, if hasattr(package, 'init') or package.state == 'to install': mode = 'init' - if hasattr(package, 'init') or hasattr(package, 'update') or package.state in ('to install', 'to upgrade'): + if needs_update: env = api.Environment(cr, SUPERUSER_ID, {}) # Can't put this line out of the loop: ir.module.module will be # registered by init_models() above. |
