[FIX] core: check module state inconsistencies after end upgrade scripts
Some modules may be removed by the upgrade scripts with the help of the ORM and are done in `end` scripts. This is the case for uninstalling the themes which use the `_theme_remove` method [1]. [1] in 12.0: https://github.com/odoo/odoo/blob/e2084a4356f63249920d8c777e92f1710be8b5a6/addons/website_theme_install/models/ir_module_module.py#L337 closes odoo/odoo#64219 X-original-commit: e5ab5410dbc006fc4bcdd21e603026483bf5d360 Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com> Signed-off-by: Christophe Simonis <chs@odoo.com>
This commit is contained in:
@@ -470,12 +470,6 @@ def load_modules(db, force_demo=False, status=None, update_module=False):
|
||||
['to install'], force, status, report,
|
||||
loaded_modules, update_module, models_to_check)
|
||||
|
||||
# check that new module dependencies have been properly installed after a migration/upgrade
|
||||
cr.execute("SELECT name from ir_module_module WHERE state IN ('to install', 'to upgrade')")
|
||||
module_list = [name for (name,) in cr.fetchall()]
|
||||
if module_list:
|
||||
_logger.error("Some modules have inconsistent states, some dependencies may be missing: %s", sorted(module_list))
|
||||
|
||||
# check that all installed modules have been loaded by the registry after a migration/upgrade
|
||||
cr.execute("SELECT name from ir_module_module WHERE state = 'installed' and name != 'studio_customization'")
|
||||
module_list = [name for (name,) in cr.fetchall() if name not in graph]
|
||||
@@ -490,6 +484,12 @@ def load_modules(db, force_demo=False, status=None, update_module=False):
|
||||
for package in graph:
|
||||
migrations.migrate_module(package, 'end')
|
||||
|
||||
# check that new module dependencies have been properly installed after a migration/upgrade
|
||||
cr.execute("SELECT name from ir_module_module WHERE state IN ('to install', 'to upgrade')")
|
||||
module_list = [name for (name,) in cr.fetchall()]
|
||||
if module_list:
|
||||
_logger.error("Some modules have inconsistent states, some dependencies may be missing: %s", sorted(module_list))
|
||||
|
||||
# STEP 3.6: apply remaining constraints in case of an upgrade
|
||||
registry.finalize_constraints()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user