Skip to content

Commit e776f86

Browse files
committed
[FIX] server: fix module dependency warning in non-module addon
If the code try to import something from a module but that code is not in a module itself, the diagnostic tool was crashing. It does not occur in odoo core, but saas-worker for example is importing base
1 parent f3e07ac commit e776f86

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

server/features/validation/python_validator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def _resolve_import(self, from_stmt, name_aliases, level, node):
8888

8989
for node_alias, symbol, file_tree in symbols:
9090
name = node_alias.name
91-
if symbol:
91+
if symbol and self.currentModule: # We test dependencies only if we are already in a module (saas-worker example)
9292
module = symbol.get_module_sym()
9393
if module and not self.currentModule.is_in_deps(module.dir_name) and not self.safeImport[-1]:
9494
self.diagnostics.append(Diagnostic(

0 commit comments

Comments
 (0)