Browse Source

FIX bug #56 crash in report_custom_filename

pull/57/head
Alexis de Lattre 9 years ago
parent
commit
b471978642
  1. 9
      report_custom_filename/controllers/reports.py

9
report_custom_filename/controllers/reports.py

@ -39,7 +39,14 @@ class Reports(main.Reports):
for report in report_xml.browse(report_ids):
if not report.download_filename:
continue
objects = http.request.session.model(context['active_model'])\
# When you are on the form view of a customer and you
# click on the "Sales" button, context['active_model']
# is still res.partner (probably a bug...) but
# context['active_ids'] has the ID of the sale order
# cf https://github.com/OCA/reporting-engine/issues/56
# That's why we use report.model instead of context['active_model']
# together with context['active_ids']
objects = http.request.session.model(report.model)\
.browse(context['active_ids'])
generated_filename = email_template.mako_template_env\
.from_string(report.download_filename)\

Loading…
Cancel
Save