[FIX] base_import_module: imported module version
- Create a simple module, set version to 2.0 - Import the zip file The 'Latest Version' (field `installed_version`) is set to 11.0.1.0, while one would expect 11.0.2.0. There are several reasons for this. First, the method `get_values_from_terp` doesn't return the version, so at this point the information is already lost. Then, the field `installed_version` is a computed field which retrieves the version from the `__manifest__.py` file. In the case of an imported module, there is no such file in which we can look up for the value (even though the imported module contained one). To avoid this, we explicitly set the 'Installed Version' (field `latest_version`) to the version retrieved at import. Since this field refers to the version installed in the database, it makes sense to use it this way. Moreover, in the case of imported modules, we use the value of `latest_version` for `installed_version`. Fixes #23988 opw-1833522
This commit is contained in:
committed by
Nicolas Martinelli
parent
71862789f2
commit
adfec42561
@@ -24,6 +24,13 @@ class IrModule(models.Model):
|
||||
|
||||
imported = fields.Boolean(string="Imported Module")
|
||||
|
||||
@api.depends('name')
|
||||
def _get_latest_version(self):
|
||||
imported_modules = self.filtered(lambda m: m.imported and m.latest_version)
|
||||
for module in imported_modules:
|
||||
module.installed_version = module.latest_version
|
||||
super(IrModule, self - imported_modules)._get_latest_version()
|
||||
|
||||
@api.multi
|
||||
def _import_module(self, module, path, force=False):
|
||||
known_mods = self.search([])
|
||||
@@ -32,6 +39,8 @@ class IrModule(models.Model):
|
||||
|
||||
terp = load_information_from_description_file(module, mod_path=path)
|
||||
values = self.get_values_from_terp(terp)
|
||||
if 'version' in terp:
|
||||
values['latest_version'] = terp['version']
|
||||
|
||||
unmet_dependencies = set(terp['depends']).difference(installed_mods)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user