Skip to content

Commit e311e98

Browse files
aj-fuentesWajih-Wanis
authored andcommitted
[FIX] core: fix migration order
When we list the versions to upgrade we go over the values in `self.migrations[pkg.name]`. This object is a mapping of mappings `{script_location: {version: scripts_list}}`. The location could be `module` or `module_upgrades` for local scripts, or `upgrade` for scripts in any of the extra upgrade paths. The problem is that if we have a minor version that matches a major one in different locations the order is non-deterministic. For example if we have a local upgrade script in `1.2`, and an extra upgrade script in `16.0.1.2`. Both `version` keys (`1.2` and `16.0.1.2`) will resolve to `16.0.1.2` when ordering. But the order they _actually_ appear in the set of versions is non-deterministic --due to the `set` implementation in Python. The solution is to use a container that keeps the order, in this case a `dict`. closes odoo#234209 X-original-commit: 55f6062 Signed-off-by: Christophe Simonis (chs) <chs@odoo.com> Signed-off-by: Alvaro Fuentes Suarez (afu) <afu@odoo.com>
1 parent d38db9e commit e311e98

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

odoo/modules/migration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def convert_version(version):
167167

168168
def _get_migration_versions(pkg, stage):
169169
versions = sorted({
170-
ver
170+
ver: None
171171
for lv in self.migrations[pkg.name].values()
172172
for ver, lf in lv.items()
173173
if lf

0 commit comments

Comments
 (0)