[FIX] report_sxw: setLang() should discard browse_record cache

`setLang` alters the "browse" context of the documents
being printed, but it must also discard any values
already cached, as they could be using a different language.
This is the case when the report uses translatable fields
on `res.partner`, because `setLang` is usually called
with the target partner language, hence prefetching
the translatable fields with the user's language instead
of the partner's language.

E.g. `setLang(o.partner_id.lang)` will cache any
translatable field on `o.partner_id` in the language of
the *user*, not the *partner*.
This commit is contained in:
Olivier Dony 2015-04-07 18:33:48 +02:00
parent ffacce7140
commit 56c95d2843
1 changed files with 1 additions and 0 deletions

View File

@ -234,6 +234,7 @@ class rml_parse(object):
self.localcontext['lang'] = lang
self.lang_dict_called = False
for obj in self.objects:
obj.refresh()
obj._context['lang'] = lang
def _get_lang_dict(self):