From 19742eb91eadeecfbddd64d41848cfb4a525a7da Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Tue, 23 Mar 2021 15:21:44 +0000 Subject: [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#68260 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(-) (limited to 'odoo') diff --git a/odoo/tools/translate.py b/odoo/tools/translate.py index 24631f4d53f..e12be2998f6 100644 --- a/odoo/tools/translate.py +++ b/odoo/tools/translate.py @@ -601,7 +601,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: -- cgit v1.2.3