summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Trigaux <mat@odoo.com>2015-09-17 15:53:53 +0200
committerMartin Trigaux <mat@odoo.com>2015-09-17 17:09:55 +0200
commitcafe326b5906cf2dfce5ddf07cd53da921bbd4bb (patch)
tree09a79c0e20812f55ffc206029b98f82617d52d6f
parent90dfaa7addb9ffa72415fe46a6de16849004576c (diff)
[FIX] tools: avoid duplicates when synchronising translation
The "Synchronise translation" wizard almost doubles the number of translated terms in database. This is due to the loss of the module reference at the synchronisation (`module_name` is empty as updating all modules) Only overwrite the module when it is set (default None) Fixes #6149 Second part of the patches avoid inserting translations without any module for locale xml ids.
-rw-r--r--openerp/tools/translate.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/openerp/tools/translate.py b/openerp/tools/translate.py
index d3d1fdbf848..1b749354710 100644
--- a/openerp/tools/translate.py
+++ b/openerp/tools/translate.py
@@ -1031,7 +1031,8 @@ def trans_load_data(cr, fileobj, fileformat, lang, lang_name=None, verbose=True,
if isinstance(res_id, (int, long)) or \
(isinstance(res_id, basestring) and res_id.isdigit()):
dic['res_id'] = int(res_id)
- dic['module'] = module_name
+ if module_name:
+ dic['module'] = dic['module']
else:
# res_id is an xml id
dic['res_id'] = None
@@ -1039,7 +1040,7 @@ def trans_load_data(cr, fileobj, fileformat, lang, lang_name=None, verbose=True,
if '.' in res_id:
dic['module'], dic['imd_name'] = res_id.split('.', 1)
else:
- dic['module'], dic['imd_name'] = False, res_id
+ dic['module'], dic['imd_name'] = module_name, res_id
irt_cursor.push(dic)