Commit efda0ab2 authored by Jérome Perrin's avatar Jérome Perrin

deferred_style: call report method with user language

Some report sections may be using translation.
parent 9debeb6e
...@@ -5,14 +5,15 @@ form = context.restrictedTraverse(form) ...@@ -5,14 +5,15 @@ form = context.restrictedTraverse(form)
request = container.REQUEST request = container.REQUEST
request.other.update(request_other) request.other.update(request_other)
if form.meta_type == 'ERP5 Report': with portal.Localizer.translationContext(localizer_language):
if form.meta_type == 'ERP5 Report':
report_section_list = getattr(context, form.report_method)() report_section_list = getattr(context, form.report_method)()
elif form.meta_type == 'ERP5 Form': elif form.meta_type == 'ERP5 Form':
report_section_list = [] report_section_list = []
for field in form.get_fields(): for field in form.get_fields():
if field.getRecursiveTemplateField().meta_type == 'ReportBox': if field.getRecursiveTemplateField().meta_type == 'ReportBox':
report_section_list.extend(field.render()) report_section_list.extend(field.render())
else: else:
raise ValueError, 'form meta_type (%r) unknown' %(form.meta_type,) raise ValueError, 'form meta_type (%r) unknown' %(form.meta_type,)
# Rebuild request_other as report section can have modify request content # Rebuild request_other as report section can have modify request content
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment