[FIX] db: list db without a base module

If a database had no base module or no latest_version, mark it as incompatible.
This should not happen in standard but as we are considering local databases
that may be non-odoo, we should be more fault tolerant.
This commit is contained in:
Martin Trigaux
2017-02-02 14:23:16 +01:00
parent 1cbf3fccd1
commit d436061ee6
+7 -3
View File
@@ -357,10 +357,14 @@ def list_db_incompatible(databases):
cr.execute("SELECT 1 FROM information_schema.tables WHERE table_name='ir_module_module'")
if cr.fetchone():
cr.execute("SELECT latest_version FROM ir_module_module WHERE name=%s", ('base',))
base_version = cr.fetchone()[0]
# e.g. 10.saas~15
if '.'.join(base_version.split('.')[:2]) != server_version:
base_version = cr.fetchone()
if not base_version or not base_version[0]:
incompatible_databases.append(database_name)
else:
# e.g. 10.saas~15
local_version = '.'.join(base_version[0].split('.')[:2])
if local_version != server_version:
incompatible_databases.append(database_name)
else:
incompatible_databases.append(database_name)
# release connection