[FIX] reports: report_type may be missing from the action descriptor, don't rely on it being there
bzr revid: xmo@openerp.com-20110908071415-9gdyvkpwq7i7fxob
This commit is contained in:
parent
a0a1ea0cfa
commit
e13a97446a
|
@ -1362,13 +1362,15 @@ class Reports(View):
|
||||||
context = req.session.eval_context(
|
context = req.session.eval_context(
|
||||||
openerpweb.nonliterals.CompoundContext(
|
openerpweb.nonliterals.CompoundContext(
|
||||||
req.context or {}, action[ "context"]))
|
req.context or {}, action[ "context"]))
|
||||||
|
|
||||||
|
report_data = {"id": context["active_id"], "model": context["active_model"]}
|
||||||
|
if 'report_type' in action:
|
||||||
|
report_data['report_type'] = action['report_type']
|
||||||
report_id = report_srv.report(
|
report_id = report_srv.report(
|
||||||
req.session._db, req.session._uid, req.session._password,
|
req.session._db, req.session._uid, req.session._password,
|
||||||
action["report_name"], context["active_ids"],
|
action["report_name"], context["active_ids"],
|
||||||
{"id": context["active_id"],
|
report_data, context)
|
||||||
"model": context["active_model"],
|
|
||||||
"report_type": action["report_type"]},
|
|
||||||
context)
|
|
||||||
report_struct = None
|
report_struct = None
|
||||||
while True:
|
while True:
|
||||||
report_struct = report_srv.report_get(
|
report_struct = report_srv.report_get(
|
||||||
|
@ -1384,7 +1386,7 @@ class Reports(View):
|
||||||
report_struct['format'], 'octet-stream')
|
report_struct['format'], 'octet-stream')
|
||||||
return req.make_response(report,
|
return req.make_response(report,
|
||||||
headers=[
|
headers=[
|
||||||
('Content-Disposition', 'attachment; filename="%s.%s"' % (action['report_name'], action['report_type'])),
|
('Content-Disposition', 'attachment; filename="%s.%s"' % (action['report_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