Merge branch 'ref-simplify-odoo-versions-list' into 'main'
[REF] simplify odoo version list configuration See merge request odoo-openupgrade-wizard/odoo-openupgrade-wizard!75
This commit is contained in:
commit
29674afe84
1
newsfragments/version-simplification.misc
Normal file
1
newsfragments/version-simplification.misc
Normal file
|
|
@ -0,0 +1 @@
|
|||
Refactor to simplify configuration_version_dependant.py file.
|
||||
|
|
@ -2,35 +2,7 @@ from pathlib import Path
|
|||
|
||||
from loguru import logger
|
||||
|
||||
_ODOO_VERSION_TEMPLATES = [
|
||||
{
|
||||
"version": 8.0,
|
||||
},
|
||||
{
|
||||
"version": 9.0,
|
||||
},
|
||||
{
|
||||
"version": 10.0,
|
||||
},
|
||||
{
|
||||
"version": 11.0,
|
||||
},
|
||||
{
|
||||
"version": 12.0,
|
||||
},
|
||||
{
|
||||
"version": 13.0,
|
||||
},
|
||||
{
|
||||
"version": 14.0,
|
||||
},
|
||||
{
|
||||
"version": 15.0,
|
||||
},
|
||||
{
|
||||
"version": 16.0,
|
||||
},
|
||||
]
|
||||
_ALL_ODOO_VERSIONS = [8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0]
|
||||
|
||||
|
||||
def get_version_options(mode: str) -> list:
|
||||
|
|
@ -42,7 +14,7 @@ def get_version_options(mode: str) -> list:
|
|||
Exemple:
|
||||
['9.0', '10.0', '11.0']
|
||||
"""
|
||||
version_options = [str(x["version"]) for x in _ODOO_VERSION_TEMPLATES]
|
||||
version_options = [str(version) for version in _ALL_ODOO_VERSIONS]
|
||||
if mode == "initial":
|
||||
version_options = version_options[:-1]
|
||||
if mode == "final":
|
||||
|
|
@ -55,12 +27,9 @@ def get_odoo_versions(initial_version: float, final_version: float) -> list:
|
|||
version
|
||||
"""
|
||||
result = []
|
||||
for version_template in _ODOO_VERSION_TEMPLATES:
|
||||
if (
|
||||
version_template["version"] >= initial_version
|
||||
and version_template["version"] <= final_version
|
||||
):
|
||||
result.append(version_template["version"])
|
||||
for version in _ALL_ODOO_VERSIONS:
|
||||
if version >= initial_version and version <= final_version:
|
||||
result.append(version)
|
||||
return result
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user