[9.0][FIX][report_custom_filename] API migration (#92)

pull/93/head
Pedro Castro Silva 2017-01-07 01:21:07 +00:00 committed by Pedro M. Baeza
parent e20ffe75a4
commit 98f8b336f7
1 changed files with 4 additions and 6 deletions

View File

@ -16,13 +16,11 @@ class Reports(main.Reports):
action = json.loads(action) action = json.loads(action)
context = dict(http.request.context) context = dict(http.request.context)
context.update(action["context"]) context.update(action["context"])
report_xml = http.request.session.model('ir.actions.report.xml') report_xml = http.request.env['ir.actions.report.xml']
reports = report_xml.search( reports = report_xml.search([
[('report_name', '=', action['report_name'])], ('report_name', '=', action['report_name']),
0, False, False, context) ('download_filename', '!=', False)])
for report in reports: for report in reports:
if not report.download_filename:
continue
objects = http.request.session.model(context['active_model'])\ objects = http.request.session.model(context['active_model'])\
.browse(context['active_ids']) .browse(context['active_ids'])
generated_filename = mail_template.mako_template_env\ generated_filename = mail_template.mako_template_env\