[FIX] l10n_multilang: overwrite existing translations
When a record is created in a different language than English, empty
translations are created using the _set_ids method for translatable fields.
l10n_multilang makes the account translatable, an empty translation is created
when the CoA data is processed.
After the CoA installation, l10n_multilang transfer the translations of the
account templates to the related accounts.
No need to create translation terms again, use _set_ids to update the existing
translations.
This will prevent a cause of translation duplication, forbidden in the future by
160d657704
opw-1832071
Closes #24158
This commit is contained in:
@@ -32,14 +32,14 @@ class AccountChartTemplate(models.Model):
|
||||
for element in in_ids.with_context(lang=None):
|
||||
if value[element.id]:
|
||||
#copy Translation from Source to Destination object
|
||||
xlat_obj.create({
|
||||
'name': out_ids._name + ',' + in_field,
|
||||
'type': 'model',
|
||||
'res_id': out_ids[counter].id,
|
||||
'lang': lang,
|
||||
'src': element[in_field],
|
||||
'value': value[element.id],
|
||||
})
|
||||
xlat_obj._set_ids(
|
||||
out_ids._name + ',' + in_field,
|
||||
'model',
|
||||
lang,
|
||||
out_ids[counter].ids,
|
||||
value[element.id],
|
||||
element[in_field]
|
||||
)
|
||||
else:
|
||||
_logger.info('Language: %s. Translation from template: there is no translation available for %s!' % (lang, element[in_field]))
|
||||
counter += 1
|
||||
|
||||
Reference in New Issue
Block a user