[FIX] core: fix import error after translate override

When a model_terms translated field is overridden to a model translated field.
Its terms in the po files should be ignored otherwise calling field.translate
which is boolean will cause error.

opw-3644158

closes odoo/odoo#148518

X-original-commit: 50b314ff3c5d5003ad570d29a05bacd832d70362
Signed-off-by: Raphael Collet <rco@odoo.com>
Signed-off-by: Chong Wang (cwg) <cwg@odoo.com>
This commit is contained in:
Chong Wang (cwg)
2024-01-10 06:12:25 +00:00
parent c14813c17f
commit 4ccc64a3e5
+2 -2
View File
@@ -1369,9 +1369,9 @@ class TranslationImporter:
xmlid = module_name + '.' + row['imd_name']
if xmlids and xmlid not in xmlids:
continue
if row.get('type') == 'model':
if row.get('type') == 'model' and field.translate is True:
self.model_translations[model_name][field_name][xmlid][lang] = row['value']
elif row.get('type') == 'model_terms':
elif row.get('type') == 'model_terms' and callable(field.translate):
self.model_terms_translations[model_name][field_name][xmlid][row['src']][lang] = row['value']
def save(self, overwrite=False, force_overwrite=False):