[FIX] base: do not overwrite noupdate translations

If a record is tagged with no update, the translations must not be replaced,
even if the "overwrite translation" checkbox is checked.

If somebody renames a noupdate and translated record, updating the translations
must keep the new translations.

Closes #14768
This commit is contained in:
Martin Trigaux
2017-03-29 13:41:09 +02:00
parent 1a2c05e98b
commit 1703a2f806
+8 -3
View File
@@ -47,7 +47,8 @@ class IrTranslationImport(object):
# of ir_translation, so this copy will be much faster.
query = """ CREATE TEMP TABLE %s (
imd_model VARCHAR(64),
imd_name VARCHAR(128)
imd_name VARCHAR(128),
noupdate BOOLEAN
) INHERITS (%s) """ % (self._table, self._model_table)
self._cr.execute(query)
@@ -104,7 +105,8 @@ class IrTranslationImport(object):
# Step 1: resolve ir.model.data references to res_ids
cr.execute(""" UPDATE %s AS ti
SET res_id = imd.res_id
SET res_id = imd.res_id,
noupdate = imd.noupdate
FROM ir_model_data AS imd
WHERE ti.res_id IS NULL
AND ti.module IS NOT NULL AND ti.imd_name IS NOT NULL
@@ -150,7 +152,10 @@ class IrTranslationImport(object):
src = ti.src,
state = 'translated'
FROM %s AS ti
WHERE %s AND ti.value IS NOT NULL AND ti.value != ''
WHERE %s
AND ti.value IS NOT NULL
AND ti.value != ''
AND noupdate IS NOT TRUE
""" % (self._model_table, self._table, find_expr),
(tuple(src_relevant_fields), tuple(src_relevant_fields)))