diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-07-05 16:23:47 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-07-05 16:23:47 +0200 |
| commit | 84210074e55d906ea3c36e3a79741f83c5a55215 (patch) | |
| tree | 4e1b19abc8e9f587da5a605ed2aa5d00b535d29d /odoo/modules/loading.py | |
| parent | a978a3647a8ed8a08311f56dcf2f3e04056052b8 (diff) | |
| parent | b06c09db604a580acc85eb75ce68f42880ba9b73 (diff) | |
[MERGE] forward port branch saas-15 up to b06c09db604
Diffstat (limited to 'odoo/modules/loading.py')
| -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 29f2191f905..0b2474eaddd 100644 --- a/odoo/modules/loading.py +++ b/odoo/modules/loading.py @@ -123,7 +123,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' @@ -136,8 +146,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) @@ -157,7 +166,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. |
