Skip to content

[12.0] update_translations with overwrite=True doesn't work #61

Description

@yankinmax

Here

def update_translations(ctx, module_list, overwrite=False):
""" Update translations from module list"""
if not isinstance(module_list, list):
raise AnthemError(u"You have to provide a list of "
"module's name to update the translations")
if overwrite:
ctx.log_line(
u'All previous translations will be dropped for requested addons'
)
ir_module = ctx.env['ir.module.module']
if hasattr(ir_module, 'update_translations'):
# Odoo version <= 10.0
method_name = 'update_translations'
else:
# Odoo version >= 11.0
method_name = '_update_translations'
domain = [('name', 'in', module_list)]
mods = ctx.env['ir.module.module'].search(domain)
ctx.log_line('Reloading translations for %s' % str(module_list))
mods.with_context(overwrite=overwrite)
getattr(mods, method_name)()

we specify overwrite=True, so existing translation should be overwritten.
While debugging here (where it's supposed to be upserted)
https://github.com/odoo/odoo/blob/5d40023eaf9b3c25941429e7fac266722780846d/odoo/addons/base/models/ir_translation.py#L137
always have self._overwrite=False.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions