Impacted versions:

11.0 (saas)

Steps to reproduce:

- Create a simple module, ser version to 1.0
- Import it using odoo studio.
- Check the version (11.0.1.0)
- Change the version.
- Import it again (or even un-install it and install it again if you wish)

Current behavior:

- Version is yet 11.0.1.0

Expected behavior:

- Take the proper version from the module itself

Video/Screenshot link (optional):


import ast
import base64
import logging
import lxml
import os
import sys
import zipfile
from os.path import join as opj
from odoo import api, fields, models, _
from odoo.exceptions import UserError
from odoo.modules import load_information_from_description_file
from odoo.tools import convert_file, exception_to_unicode, pycompat
from odoo.tools.osutil import tempdir
_logger = logging.getLogger(__name__)
MAX_FILE_SIZE = 100 * 1024 * 1024  
class IrModule(models.Model):
    _inherit = "ir.module.module"
    imported = fields.Boolean(string="Imported Module")
    @api.multi
    def _import_module(self, module, path, force=False):
        known_mods = self.search([])
        known_mods_names = {m.name: m for m in known_mods}
        installed_mods = [m.name for m in known_mods if m.state == 'installed']
        terp = load_information_from_description_file(module, mod_path=path)
        values = self.get_values_from_terp(terp)
        unmet_dependencies = set(terp['depends']).difference(installed_mods)