Remove babi_execution_ in get_access in case model is not current available

#161937
This commit is contained in:
Raimon Esteve 2023-08-31 16:19:27 +02:00
parent 316eacbeac
commit 9828e3b77e
1 changed files with 21 additions and 0 deletions

View File

@ -40,3 +40,24 @@ index d762a27a..5ca47c34 100644
related_records = Model.browse([x[0] for x in cursor])
else:
with inactive_records():
diff --git a/tryton/trytond/trytond/ir/model.py b/tryton/trytond/trytond/ir/model.py
index 6304018f24..1ea08d8be5 100644
--- a/tryton/trytond/trytond/ir/model.py
+++ b/tryton/trytond/trytond/ir/model.py
@@ -555,8 +555,14 @@ class ModelAccess(DeactivableMixin, ModelSQL, ModelView):
fill_models(field.get_target(), models)
model2models = defaultdict(list)
for model in models:
- fill_models(pool.get(model), model2models[model])
-
+ try:
+ fill_models(pool.get(model), model2models[model])
+ except KeyError as err:
+ if 'babi_execution_' in str(err):
+ models.remove(model)
+ continue
+ else:
+ raise
all_models = list(set(sum(model2models.values(), [])))
default = {'read': True, 'write': True, 'create': True, 'delete': True}
default_singleton = {