summaryrefslogtreecommitdiff
path: root/odoo/tools
diff options
context:
space:
mode:
authorNicolas Lempereur <nle@odoo.com>2021-03-23 15:21:44 +0000
committerNicolas Lempereur <nle@odoo.com>2021-03-23 17:27:22 +0000
commit19742eb91eadeecfbddd64d41848cfb4a525a7da (patch)
tree79588d1185f2e86fc44c10a721a7b73f7f2428cb /odoo/tools
parenta1dfab57d9af2c0ecb5c414d48203a3b51729135 (diff)
[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) <mat@odoo.com> Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Diffstat (limited to 'odoo/tools')
-rw-r--r--odoo/tools/translate.py3
1 files changed, 2 insertions, 1 deletions
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 <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: