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.
Here
anthem/anthem/lyrics/modules.py
Lines 23 to 44 in e067afb
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.