From a37b0171dd7742e5c3e452733ef7959819205695 Mon Sep 17 00:00:00 2001 From: vava-odoo Date: Thu, 22 Feb 2024 17:53:54 +0100 Subject: [PATCH] [FIX] core: no warning in Graph for imported modules Before this PR, after having imported a module, a warning appears in the log, because it tries to update the graph which does not make sense for an imported module. This commit makes sure the warning is skipped if the module was imported. closes odoo/odoo#155096 Signed-off-by: Christophe Simonis (chs) --- odoo/modules/graph.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/odoo/modules/graph.py b/odoo/modules/graph.py index efe8629b466..752237b4b0a 100644 --- a/odoo/modules/graph.py +++ b/odoo/modules/graph.py @@ -3,6 +3,7 @@ """ Modules dependency graph. """ +import functools import itertools import logging @@ -11,6 +12,15 @@ import odoo.tools as tools _logger = logging.getLogger(__name__) + +@functools.lru_cache(maxsize=1) +def _ignored_modules(cr): + result = ['studio_customization'] + if tools.sql.column_exists(cr, 'ir_module_module', 'imported'): + cr.execute('SELECT name FROM ir_module_module WHERE imported') + result += [m[0] for m in cr.fetchall()] + return result + class Graph(dict): """ Modules dependency graph. @@ -61,7 +71,7 @@ class Graph(dict): info = odoo.modules.module.get_manifest(module) if info and info['installable']: packages.append((module, info)) # TODO directly a dict, like in get_modules_with_version - elif module != 'studio_customization': + elif module not in _ignored_modules(cr): _logger.warning('module %s: not installable, skipped', module) dependencies = dict([(p, info['depends']) for p, info in packages])