[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
This commit is contained in:
Martin Trigaux 2014-12-15 17:06:14 +01:00
parent 4a3e5df93a
commit d6b26c6890
1 changed files with 6 additions and 1 deletions

View File

@ -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: