diff --git a/src/util/const.py b/src/util/const.py index 2d1ba26c1..5158faec3 100644 --- a/src/util/const.py +++ b/src/util/const.py @@ -15,6 +15,7 @@ "__modules_auto_discovery_force_upgrades": {}, "__fix_fk_allowed_cascade": [], "__no_model_data_delete": {}, + "__force_installed_modules": set(), } NEARLYWARN = 25 # between info and warning; appear on runbot build page diff --git a/src/util/modules.py b/src/util/modules.py index e3802d1dc..f7bf363e5 100644 --- a/src/util/modules.py +++ b/src/util/modules.py @@ -148,6 +148,16 @@ def module_installed(cr, module): return modules_installed(cr, module) +def module_force_installed(module): + """ + Return whether a module is force installed during the upgrade. + + :param str module: name of the module to check + :rtype: bool + """ + return module in ENVIRON["__force_installed_modules"] + + @_warn_usage_outside_base def uninstall_module(cr, module): """ @@ -655,6 +665,8 @@ def _force_install_module(cr, module, if_installed=None, reason="it has been exp states = dict(cr.fetchall()) toinstall = [m for m in states if states[m] == "to install"] + ENVIRON["__force_installed_modules"].update(toinstall) + if module in toinstall: _logger.info( "force install of module %r (and its dependencies) because %s%s",