[FIX] report: abstract reports default lang

In ir_ui_view.py, in method render (line 132 atm),
the values passed to the rendering engine is a merge of the context
and the values.

Therefore, if at this place, the language is rightly set in the context,
the report lang will be as well in the values.

In abstract_report.py, the values passed to the render method is the
wrapped report localcontext in which are added some key/values
(docs, doc_ids, doc_model).
By default, the lang in the localcontext is False
See __init__ method of rml_parse class in report_sxw.py.
If setLang method is not called, the lang in the localcontext remains False.

In this rev., we avoid to overwrite the lang from the context by the lang
of the localcontext if this one is False, so the lang of the report is set
with the current context lang.

Forcing the lang of the report to False had as side-effect to prevent the
editing of report using the website editor(e.g. playslip_report)

opw-628720
This commit is contained in:
Denis Ledoux 2015-02-24 17:33:35 +01:00
parent cbb51610ee
commit 22606c8905
1 changed files with 3 additions and 1 deletions

View File

@ -54,7 +54,9 @@ class AbstractReport(osv.AbstractModel):
# Rendering self._template with the wrapped report instance localcontext as
# rendering environment
docargs = wrapped_report.localcontext
docargs = dict(wrapped_report.localcontext)
if not docargs.get('lang'):
docargs.pop('lang', False)
docargs['docs'] = docargs.get('objects')
# Used in template translation (see translate_doc method from report model)