Use Pool classes attributes to get allowed pool types

This commit is contained in:
Nicolas Évrard committed 2026-06-06 16:16:47 +02:00
1 parent e81b251a09
commit b54668ad94
2 files changed
+4 -2

No files matched your search

+3 -1
View File
@@ -81,13 +81,15 @@ def get_module_info(name, path=(), with_test=False):
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(
+1 -1
View File
@@ -89,7 +89,7 @@ class Pool(object):
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]