details:   https://code.tryton.org/tryton/commit/e56f603ce8a8
branch:    default
user:      Nicolas Évrard <[email protected]>
date:      Sat Jun 06 16:16:47 2026 +0200
description:
        Use Pool classes attributes to get allowed pool types
diffstat:

 trytond/trytond/modules/__init__.py |  4 +++-
 trytond/trytond/pool.py             |  2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diffs (32 lines):

diff -r 6e935934bff3 -r e56f603ce8a8 trytond/trytond/modules/__init__.py
--- a/trytond/trytond/modules/__init__.py       Wed Aug 19 19:22:03 2026 +0200
+++ b/trytond/trytond/modules/__init__.py       Sat Jun 06 16:16:47 2026 +0200
@@ -81,13 +81,15 @@
 
 def get_module_register(name, path=(), with_test=False):
     "Return classes to register from tryton.cfg"
+    from trytond.pool import Pool
+
     module_config, _ = parse_module_config(name, path)
     if module_config is None:
         return
     for section in module_config.sections():
         if section == 'register' or section.startswith('register '):
             depends = section[len('register'):].strip().split()
-            for type_ in ['model', 'report', 'wizard']:
+            for type_ in Pool.classes:
                 if not module_config.has_option(section, type_):
                     continue
                 classes = module_config.get(
diff -r 6e935934bff3 -r e56f603ce8a8 trytond/trytond/pool.py
--- a/trytond/trytond/pool.py   Wed Aug 19 19:22:03 2026 +0200
+++ b/trytond/trytond/pool.py   Sat Jun 06 16:16:47 2026 +0200
@@ -89,7 +89,7 @@
             module = kwargs['module']
             type_ = kwargs['type_']
             depends = set(kwargs.get('depends', []))
-            assert type_ in {'model', 'report', 'wizard'}, (
+            assert type_ in Pool.classes, (
                 f"{type_} is not a valid type_")
             for cls in classes:
                 mpool = Pool.classes[type_][module]

Reply via email to