summaryrefslogtreecommitdiff
path: root/odoo/tools
diff options
context:
space:
mode:
authorMartin Trigaux <mat@odoo.com>2018-08-02 16:50:05 +0200
committerMartin Trigaux <mat@odoo.com>2018-09-11 09:14:53 +0200
commitfccfd36e0511b209e086657ec3e6c2f66923082e (patch)
treef448b1f4dd5c97d769c7fb88780a5af4da6480ec /odoo/tools
parentdabe5bfbae10de983bd1cbdba38949f17a62562e (diff)
[FIX] tools: skip bad translations
cherry-pick of 428fbd03813 that was reverted at 737ba55e1ee34e8 as it was making tests fail The following commit will correct the tests This commit only reverts the revert
Diffstat (limited to 'odoo/tools')
-rw-r--r--odoo/tools/translate.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/odoo/tools/translate.py b/odoo/tools/translate.py
index 2d7981c2987..575742c8e3f 100644
--- a/odoo/tools/translate.py
+++ b/odoo/tools/translate.py
@@ -1101,10 +1101,14 @@ def trans_load_data(cr, fileobj, fileformat, lang, lang_name=None, verbose=True,
# discard the target from the POT targets.
src = dic['src']
- if src in pot_targets:
- target = pot_targets[src]
- target.value = dic['value']
- target.targets.discard((dic['type'], dic['name'], dic['type'] != 'code' and dic['res_id'] or 0))
+ target = pot_targets.get(src)
+ if not target or (dic['type'], dic['name'], dic['res_id']) not in target.targets:
+ _logger.info("Translation '%s' (%s, %s, %s) not found in reference pot, skipping",
+ src[:60], dic['type'], dic['name'], dic['res_id'])
+ return
+
+ target.value = dic['value']
+ target.targets.discard((dic['type'], dic['name'], dic['type'] != 'code' and dic['res_id'] or 0))
# This would skip terms that fail to specify a res_id
res_id = dic['res_id']