[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:
@@ -47,7 +47,8 @@ class IrTranslationImport(object):
|
|||||||
# of ir_translation, so this copy will be much faster.
|
# of ir_translation, so this copy will be much faster.
|
||||||
query = """ CREATE TEMP TABLE %s (
|
query = """ CREATE TEMP TABLE %s (
|
||||||
imd_model VARCHAR(64),
|
imd_model VARCHAR(64),
|
||||||
imd_name VARCHAR(128)
|
imd_name VARCHAR(128),
|
||||||
|
noupdate BOOLEAN
|
||||||
) INHERITS (%s) """ % (self._table, self._model_table)
|
) INHERITS (%s) """ % (self._table, self._model_table)
|
||||||
self._cr.execute(query)
|
self._cr.execute(query)
|
||||||
|
|
||||||
@@ -104,7 +105,8 @@ class IrTranslationImport(object):
|
|||||||
|
|
||||||
# Step 1: resolve ir.model.data references to res_ids
|
# Step 1: resolve ir.model.data references to res_ids
|
||||||
cr.execute(""" UPDATE %s AS ti
|
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
|
FROM ir_model_data AS imd
|
||||||
WHERE ti.res_id IS NULL
|
WHERE ti.res_id IS NULL
|
||||||
AND ti.module IS NOT NULL AND ti.imd_name IS NOT NULL
|
AND ti.module IS NOT NULL AND ti.imd_name IS NOT NULL
|
||||||
@@ -150,7 +152,10 @@ class IrTranslationImport(object):
|
|||||||
src = ti.src,
|
src = ti.src,
|
||||||
state = 'translated'
|
state = 'translated'
|
||||||
FROM %s AS ti
|
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),
|
""" % (self._model_table, self._table, find_expr),
|
||||||
(tuple(src_relevant_fields), tuple(src_relevant_fields)))
|
(tuple(src_relevant_fields), tuple(src_relevant_fields)))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user