From cafe326b5906cf2dfce5ddf07cd53da921bbd4bb Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Thu, 17 Sep 2015 15:53:53 +0200 Subject: [PATCH] [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. --- openerp/tools/translate.py | 5 +++-- 1 file 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)