Create translation entries for help selection values

Closes #13840
(grafted from c8b60954484f6111ce028ad76dd3a9bfd6f367fc)

--HG--
branch : 6.0
This commit is contained in:
Cédric Krier committed 2025-01-26 17:06:46 +01:00
1 parent dbaa575c29
commit cee6b17006
1 file changed
+11 -7
+11 -7
View File
@@ -180,11 +180,13 @@ class Translation(ModelSQL, ModelView):
name = model.__name__ + ',' + field_name
insert(field, 'field', name, field.string)
insert(field, 'help', name, field.help)
if (hasattr(field, 'selection')
and isinstance(field.selection, (tuple, list))
and getattr(field, 'translate_selection', True)):
selection = [s for _, s in field.selection]
insert(field, 'selection', name, selection)
if hasattr(field, 'selection'):
if (isinstance(field.selection, (tuple, list))
and getattr(field, 'translate_selection', True)):
selection = [s for _, s in field.selection]
insert(field, 'selection', name, selection)
if field.help_selection:
insert(field, 'help', name, field.help_selection.values())
@classmethod
def register_wizard(cls, wizard, module_name):
@@ -1330,9 +1332,11 @@ class TranslationClean(Wizard):
field = Model._fields.get(field_name)
if not field:
return True
if not field.help:
help_ = field.help
help_selection = list(getattr(field, 'help_selection', {}).values())
if not help_ and not help_selection:
return True
if translation.src not in list(field.help):
if translation.src not in list(help_) + help_selection:
return True
def transition_clean(self):