[IMP] Improved code for set the name of pdf report
bzr revid: tpa@tinyerp.com-20120405103613-0q1dizma6lrg2si3
This commit is contained in:
parent
6f24433aef
commit
f4848e106e
|
@ -1893,9 +1893,15 @@ class Reports(View):
|
||||||
report = zlib.decompress(report)
|
report = zlib.decompress(report)
|
||||||
report_mimetype = self.TYPES_MAPPING.get(
|
report_mimetype = self.TYPES_MAPPING.get(
|
||||||
report_struct['format'], 'octet-stream')
|
report_struct['format'], 'octet-stream')
|
||||||
|
if 'name' not in action:
|
||||||
|
reports = req.session.model('ir.actions.report.xml')
|
||||||
|
res_id = reports.search([('report_name', '=',action['report_name']),],
|
||||||
|
0, False, False, context)
|
||||||
|
action['name'] = reports.read(res_id, ['name'], context)[0]['name']
|
||||||
|
|
||||||
return req.make_response(report,
|
return req.make_response(report,
|
||||||
headers=[
|
headers=[
|
||||||
('Content-Disposition', 'attachment; filename="%s.%s"' % (action['report_name'], report_struct['format'])),
|
('Content-Disposition', 'attachment; filename="%s.%s"' % (action['name'], report_struct['format'])),
|
||||||
('Content-Type', report_mimetype),
|
('Content-Type', report_mimetype),
|
||||||
('Content-Length', len(report))],
|
('Content-Length', len(report))],
|
||||||
cookies={'fileToken': int(token)})
|
cookies={'fileToken': int(token)})
|
||||||
|
|
Loading…
Reference in New Issue