changeset 5ba16bdb2a1c in trytond:default
details: https://hg.tryton.org/trytond?cmd=changeset&node=5ba16bdb2a1c
description:
Skip lazy string translation when model is no more in the Pool
issue10351
diffstat:
trytond/ir/translation.py | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diffs (28 lines):
diff -r ecbcef79165c -r 5ba16bdb2a1c trytond/ir/translation.py
--- a/trytond/ir/translation.py Sun Apr 25 18:19:29 2021 +0200
+++ b/trytond/ir/translation.py Tue Apr 27 10:38:24 2021 +0200
@@ -324,15 +324,21 @@
if translations[record.id] is None:
with Transaction().set_context(language=lang):
if ttype in {'field', 'help'}:
- field = getattr(
- pool.get(record.model.model), record.name)
+ try:
+ field = getattr(
+ pool.get(record.model.model), record.name)
+ except KeyError:
+ continue
translations[record.id] = ''
if ttype == 'field':
value = field.string
else:
value = field.help
else:
- model = pool.get(record.model)
+ try:
+ model = pool.get(record.model)
+ except KeyError:
+ continue
if not model.__doc__:
continue
value = model._get_name()