[FIX] ir_translation: prevent `overwrite` propagation

Once set for the loading of terms for a lang,
the flag `overwrite` was propagated to all
other following languages, even if not actually needed.

Use case:
 - Installed languages: en_US, de, fr_CH, it
 - Update of the `sale` module
 - In `load_module_terms`, the system iterates through the languages:
   1. en_US: No problem
   2. de: No problem
   3. fr_CH: The flag `overwrite` is set to `True`,
      because the sub-language `fr_CH` should overwrite the `fr` terms
   4. it: The flag is still set to `True`, because of the previous iteration,
      while it must not.

opw-654042
This commit is contained in:
Frédéric Garbely 2015-12-09 17:15:43 +01:00 committed by Denis Ledoux
parent 22d0592c9a
commit ff2910f8f2
1 changed files with 2 additions and 1 deletions

View File

@ -468,12 +468,13 @@ class ir_translation(osv.osv):
return ir_translation_import_cursor(cr, uid, self, context=context)
def load_module_terms(self, cr, modules, langs, context=None):
context = dict(context or {}) # local copy
context_template = dict(context or {}) # local copy
for module_name in modules:
modpath = openerp.modules.get_module_path(module_name)
if not modpath:
continue
for lang in langs:
context = dict(context_template)
lang_code = tools.get_iso_codes(lang)
base_lang_code = None
if '_' in lang_code: