summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorRaphael Collet <rco@openerp.com>2012-05-09 17:01:10 +0200
committerRaphael Collet <rco@openerp.com>2012-05-09 17:01:10 +0200
commit73e7da8dcee2e8dfab8cdeaa0a19c45a2dea1f2a (patch)
treebe3a9cd421efdc92028a93bc25be3f15643785ce /addons
parent8a4959cd290685109955677df2b75a40867d88d9 (diff)
parentf4848e106e0f0dfc1b3dad7691bce91ee79bf742 (diff)
[MERGE] trunk-report-name-tpa (pick a better file name when saving a report)
bzr revid: rco@openerp.com-20120509150110-6gx73y1vbjksm64h
Diffstat (limited to 'addons')
-rw-r--r--addons/web/controllers/main.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py
index 0dd8f747fdb..12ef0b53524 100644
--- a/addons/web/controllers/main.py
+++ b/addons/web/controllers/main.py
@@ -1818,9 +1818,15 @@ class Reports(View):
report = zlib.decompress(report)
report_mimetype = self.TYPES_MAPPING.get(
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,
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-Length', len(report))],
cookies={'fileToken': int(token)})