details:   https://code.tryton.org/tryton/commit/b4fc865717be
branch:    7.0
user:      Cédric Krier <[email protected]>
date:      Fri Jun 26 15:17:14 2026 +0200
description:
        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
        (grafted from bb96325e829df570aac1f7624c862a660c0be286)
diffstat:

 trytond/trytond/tools/misc.py |  11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diffs (21 lines):

diff -r bece09903364 -r b4fc865717be trytond/trytond/tools/misc.py
--- a/trytond/trytond/tools/misc.py     Thu Jun 18 11:04:10 2026 +0200
+++ b/trytond/trytond/tools/misc.py     Fri Jun 26 15:17:14 2026 +0200
@@ -210,8 +210,15 @@
 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:

Reply via email to