Skip to content
Snippets Groups Projects
Commit 847d4e5e authored by Christophe Simonis's avatar Christophe Simonis
Browse files

[FIX] core: correctly handle major-less upgrade scripts during major version change


closes odoo/odoo#117886

X-original-commit: c38b5baaeac28a7952601878a5b5efadf7f52984
Signed-off-by: default avatarChristophe Simonis <chs@odoo.com>
parent d12d292c
No related branches found
No related tags found
No related merge requests found
...@@ -145,12 +145,23 @@ class MigrationManager(object): ...@@ -145,12 +145,23 @@ class MigrationManager(object):
parsed_installed_version = parse_version(installed_version) parsed_installed_version = parse_version(installed_version)
current_version = parse_version(convert_version(pkg.data['version'])) current_version = parse_version(convert_version(pkg.data['version']))
versions = _get_migration_versions(pkg, stage) def compare(version):
if version == "0.0.0" and parsed_installed_version < current_version:
return True
for version in versions: full_version = convert_version(version)
if ((version == "0.0.0" and parsed_installed_version < current_version) majorless_version = (version != full_version)
or parsed_installed_version < parse_version(convert_version(version)) <= current_version):
if majorless_version:
# We should not re-execute major-less scripts when upgrading to new Odoo version
# a module in `9.0.2.0` should not re-execute a `2.0` script when upgrading to `10.0.2.0`.
return parsed_installed_version < parse_version(full_version) < current_version
return parsed_installed_version < parse_version(full_version) <= current_version
versions = _get_migration_versions(pkg, stage)
for version in versions:
if compare(version):
strfmt = {'addon': pkg.name, strfmt = {'addon': pkg.name,
'stage': stage, 'stage': stage,
'version': stageformat[stage] % version, 'version': stageformat[stage] % version,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment