Resolve Tryton modules using entrypoints

The Pool tries to resolve registered string using the path `trytond.modules.`
which can not always be imported if the module is using an entry pointing to
another package.

Closes #14914
This commit is contained in:
Cédric Krier
2026-06-26 15:17:14 +02:00
parent 02c4177b08
commit c8b75d6c5e
+9 -2
View File
@@ -192,8 +192,15 @@ def is_instance_method(cls, method):
def resolve(name):
"Resolve a dotted name to a global object."
name = name.split('.')
used = name.pop(0)
found = importlib.import_module(used)
if name[:2] == ['trytond', 'modules']:
# import the Tryton module using entry point
name = name[2:]
used = name.pop(0)
found = import_module(used)
used = found.__name__
else:
used = name.pop(0)
found = importlib.import_module(used)
for n in name:
used = used + '.' + n
try: