diff options
Diffstat (limited to 'odoo/modules/loading.py')
| -rw-r--r-- | odoo/modules/loading.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/odoo/modules/loading.py b/odoo/modules/loading.py index 9b1efca7cc4..7e20af9033e 100644 --- a/odoo/modules/loading.py +++ b/odoo/modules/loading.py @@ -187,12 +187,16 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, model_names = registry.load(cr, package) + mode = 'update' + if hasattr(package, 'init') or package.state == 'to install': + mode = 'init' + loaded_modules.append(package.name) if needs_update: models_updated |= set(model_names) models_to_check -= set(model_names) registry.setup_models(cr) - registry.init_models(cr, model_names, {'module': package.name}) + registry.init_models(cr, model_names, {'module': package.name}, mode) elif package.state != 'to remove': # The current module has simply been loaded. The models extended by this module # and for which we updated the schema, must have their schema checked again. @@ -203,10 +207,6 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, idref = {} - mode = 'update' - if hasattr(package, 'init') or package.state == 'to install': - mode = 'init' - if needs_update: env = api.Environment(cr, SUPERUSER_ID, {}) # Can't put this line out of the loop: ir.module.module will be @@ -438,6 +438,9 @@ def load_modules(db, force_demo=False, status=None, update_module=False): for package in graph: migrations.migrate_module(package, 'end') + # STEP 3.6: apply remaining constraints in case of an upgrade + registry.finalize_constraints() + # STEP 4: Finish and cleanup installations if processed_modules: env = api.Environment(cr, SUPERUSER_ID, {}) |
