Skip to content
Snippets Groups Projects
Unverified Commit 1703a2f8 authored by Martin Trigaux's avatar Martin Trigaux
Browse files

[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
parent 1a2c05e9
No related branches found
No related tags found
No related merge requests found
......@@ -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)))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment