From 4ccc64a3e5373826def096d28b4bf0c95df08574 Mon Sep 17 00:00:00 2001 From: "Chong Wang (cwg)" Date: Tue, 26 Dec 2023 21:23:45 +0800 Subject: [PATCH] [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 Signed-off-by: Chong Wang (cwg) --- odoo/tools/translate.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/odoo/tools/translate.py b/odoo/tools/translate.py index db34de25acf..9011f96d5d0 100644 --- a/odoo/tools/translate.py +++ b/odoo/tools/translate.py @@ -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):