Skip to content

Commit 19d5972

Browse files
committed
[IMP] util.modules: new hack to force the execution of upgrade scripts
Allow ``_force_upgrade_of_fresh_module`` in upgrade-util to force the execution of upgrade script for new install modules Unlike the old hack where 1. ``module_node.init`` can be changed by ``_force_upgrade_of_fresh_module`` through changing the global ``config['init']``. 2. ``module_node.init`` was propagated only through one of the longest module dependency path. The new hack uses a new explicit variable ``registry._force_upgrade_scripts`` without changing the global ``config``. odoo/odoo#189000 closes #176 Signed-off-by: Raphael Collet <rco@odoo.com>
1 parent 596b3b1 commit 19d5972

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/util/modules.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -895,6 +895,11 @@ def _force_upgrade_of_fresh_module(cr, module, init, version):
895895
# Low level implementation
896896
# Force module state to be in `to upgrade`.
897897
# Needed for migration script execution. See http://git.io/vnF7f
898+
if version_gte("saas~18.2") and init:
899+
env_ = env(cr)
900+
env_.registry._force_upgrade_scripts.add(module)
901+
return
902+
898903
cr.execute(
899904
"""
900905
UPDATE ir_module_module

0 commit comments

Comments
 (0)