Skip to content

Commit

Permalink
[IMP] util.modules: new hack to force the execution of upgrade scripts
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
HydrionBurst committed Feb 12, 2025
1 parent 596b3b1 commit 19d5972
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/util/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,11 @@ def _force_upgrade_of_fresh_module(cr, module, init, version):
# Low level implementation
# Force module state to be in `to upgrade`.
# Needed for migration script execution. See http://git.io/vnF7f
if version_gte("saas~18.2") and init:
env_ = env(cr)
env_.registry._force_upgrade_scripts.add(module)
return

cr.execute(
"""
UPDATE ir_module_module
Expand Down

0 comments on commit 19d5972

Please sign in to comment.