[FIX] report_xlsx: initialize reportname
parent
7f5c7b9004
commit
04b88a38bf
|
@ -52,8 +52,8 @@ class ReportController(ReportController):
|
|||
def report_download(self, data, context=None, token=None):
|
||||
requestcontent = json.loads(data)
|
||||
url, report_type = requestcontent[0], requestcontent[1]
|
||||
try:
|
||||
if report_type == "xlsx":
|
||||
if report_type == "xlsx":
|
||||
try:
|
||||
reportname = url.split("/report/xlsx/")[1].split("?")[0]
|
||||
docids = None
|
||||
if "/" in reportname:
|
||||
|
@ -95,10 +95,10 @@ class ReportController(ReportController):
|
|||
"Content-Disposition", content_disposition(filename)
|
||||
)
|
||||
return response
|
||||
else:
|
||||
return super().report_download(data, context=context, token=token)
|
||||
except Exception as e:
|
||||
_logger.exception("Error while generating report %s", reportname)
|
||||
se = _serialize_exception(e)
|
||||
error = {"code": 200, "message": "Odoo Server Error", "data": se}
|
||||
return request.make_response(html_escape(json.dumps(error)))
|
||||
except Exception as e:
|
||||
_logger.exception("Error while generating report %s", reportname)
|
||||
se = _serialize_exception(e)
|
||||
error = {"code": 200, "message": "Odoo Server Error", "data": se}
|
||||
return request.make_response(html_escape(json.dumps(error)))
|
||||
else:
|
||||
return super().report_download(data, context=context, token=token)
|
||||
|
|
Loading…
Reference in New Issue