From 5042d9133063bbd1fd6ca4ad75221c52df515e73 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Tue, 7 Apr 2015 12:37:11 +0200 Subject: [PATCH] [FIX] base: translation update When updating translations, the source (`src`) is irrelevant for `field` and `help` translations. Theses translation types are only matched through their `name`. --- openerp/addons/base/ir/ir_translation.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/openerp/addons/base/ir/ir_translation.py b/openerp/addons/base/ir/ir_translation.py index cdbec59c65c..0d03ca843c8 100644 --- a/openerp/addons/base/ir/ir_translation.py +++ b/openerp/addons/base/ir/ir_translation.py @@ -110,18 +110,22 @@ class ir_translation_import_cursor(object): # Records w/o res_id must _not_ be inserted into our db, because they are # referencing non-existent data. - cr.execute("DELETE FROM %s WHERE res_id IS NULL AND module IS NOT NULL" % \ - self._table_name) + cr.execute("DELETE FROM %s WHERE res_id IS NULL AND module IS NOT NULL" % self._table_name) - find_expr = "irt.lang = ti.lang AND irt.type = ti.type " \ - " AND irt.name = ti.name AND irt.src = ti.src " \ - " AND (ti.type != 'model' OR ti.res_id = irt.res_id) " + find_expr = """ + irt.lang = ti.lang + AND irt.type = ti.type + AND irt.name = ti.name + AND (ti.type IN ('field', 'help') OR irt.src = ti.src) + AND (ti.type != 'model' OR ti.res_id = irt.res_id) + """ # Step 2: update existing (matching) translations if self._overwrite: cr.execute("""UPDATE ONLY %s AS irt SET value = ti.value, - state = 'translated' + src = ti.src, + state = 'translated' FROM %s AS ti WHERE %s AND ti.value IS NOT NULL AND ti.value != '' """ % (self._parent_table, self._table_name, find_expr))