[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) <mat@odoo.com>
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
This commit is contained in:
Nicolas Lempereur
2021-03-23 18:18:21 +00:00
parent f73c7b72be
commit 5be7af0494
+2 -1
View File
@@ -574,7 +574,8 @@ class CSVFileReader:
# res_id is an external id and must follow <module>.<name>
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: