From 5be7af0494c22d238b0895b92fadaa7e8aa36efb Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Tue, 23 Mar 2021 15:21:44 +0000 Subject: [PATCH] [FIX] translate.py: import model from CSV correctly When importing transtlation from CSV, we: - cut at `:` character to get the model - used a model for types other than model and model_terms This caused error that do not happen in PO import because: - the model is before the `,` character - the imd_model column is constrained to 64 characters, and a name that is not a model could be over that size. With this changeset, the CSV import match better current PO import. opw-2439029 closes odoo/odoo#68266 X-original-commit: cff91c6acbb7ef6a884d4dc4170574b83ff6e4cb Signed-off-by: Martin Trigaux (mat) Signed-off-by: Nicolas Lempereur (nle) --- odoo/tools/translate.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/odoo/tools/translate.py b/odoo/tools/translate.py index a7a897706e7..2ddb18f21a9 100644 --- a/odoo/tools/translate.py +++ b/odoo/tools/translate.py @@ -574,7 +574,8 @@ class CSVFileReader: # res_id is an external id and must follow . entry["module"], entry["imd_name"] = entry["res_id"].split(".") entry["res_id"] = None - entry["imd_model"] = entry["name"].split(":")[0] + if entry["type"] == "model" or entry["type"] == "model_terms": + entry["imd_model"] = entry["name"].partition(',')[0] if entry["type"] == "code": if entry["src"] == self.prev_code_src: