anthem icon indicating copy to clipboard operation
anthem copied to clipboard

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

Open yankinmax opened this issue 4 years ago • 2 comments

Here https://github.com/camptocamp/anthem/blob/e067afb678c1c036e90949c5e39b9df104b45661/anthem/lyrics/modules.py#L23-L44 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.

yankinmax avatar Jul 23 '21 05:07 yankinmax

The calls seems to be:

  1. ir.module.module._update_translations
  2. ir.translation.load_module_terms
  3. tools.translate.trans_load Could you check the context in each step?

EDIT: The issue is maybe in the fourth call:

  1. tools.translate.trans_load_data: the context parameter is not propagated toir.translation method calls it seems...

sebalix avatar Jul 23 '21 06:07 sebalix

BTW for V14 this change broke our implementation here

https://github.com/odoo/odoo/commit/ac63556e239ab03c42384477385f003c7477287b

The overwrite context key has been replace by an argument. It is present on module's _update_translation() method: https://github.com/odoo/odoo/blob/14.0/odoo/addons/base/models/ir_module.py#L908

Thus for v14 we will want to call:

Module._update_translation(overwrite=overwrite)

yvaucher avatar Jul 26 '21 09:07 yvaucher