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):


for mod, error in errors.items():
            r.append("Error while importing module '%s': %r" % (mod, error))
        return '\n'.join(r), module_names
def _is_studio_custom(path):
    """
    Checks the to-be-imported records to see if there are any references to
    studio, which would mean that the module was created using studio
    Returns True if any of the records contains a context with the key
    studio in it, False if none of the records do
    """
    filepaths = []
    for level in os.walk(path):
        filepaths += [os.path.join(level[0], fn) for fn in level[2]]
    filepaths = [fp for fp in filepaths if fp.lower().endswith('.xml')]
    for fp in filepaths:
        root = lxml.etree.parse(fp).getroot()
        for record in root:
            
            try:
                
                
                ctx = ast.literal_eval(record.get('context'))
                
                
                if ctx and ctx.get('studio'):
                    return True
            except Exception:
                continue
    return False