From d6b26c6890b52bb120c93cce7350c75017356bc1 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Mon, 15 Dec 2014 17:06:14 +0100 Subject: [PATCH] [FIX] base: almost-duplicated translations ignored during import Translations are not transfered from temporary table tmp_ir_translation_import to ir_translation if translation already exists (using `find_expr`). In case of import of QWeb terms (name = 'website'), the criteria was too weak, finding already present terms in translations for different modules. e.g. term "Quantity" is already present in a QWeb view from sale module and was not imported for the translations of the website_sale module. Fixed by adding the filter criteria 'irt.module = ti.module' In case QWeb translations for the same term in the same modules were added in two imports (second term added in the future), the second was still ignored. Changed condition to check the res_id for views as well. Fixes #4239 --- openerp/addons/base/ir/ir_translation.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/openerp/addons/base/ir/ir_translation.py b/openerp/addons/base/ir/ir_translation.py index 99aa362edf2..ce6c3d11863 100644 --- a/openerp/addons/base/ir/ir_translation.py +++ b/openerp/addons/base/ir/ir_translation.py @@ -124,7 +124,12 @@ class ir_translation_import_cursor(object): 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) " + " AND irt.module = ti.module " \ + " AND ( " \ + " (ti.type NOT IN ('model', 'view')) " \ + " OR (ti.type = 'model' AND ti.res_id = irt.res_id) " \ + " OR (ti.type = 'view' AND irt.res_id IS NULL) " \ + " OR (ti.type = 'view' AND irt.res_id IS NOT NULL AND ti.res_id = irt.res_id)) " # Step 2: update existing (matching) translations if self._overwrite: