[IMP] web: log error when generating a report fails

For reports fetched through this endpoint, the error would only be
reported to the client, which may well ignore it entirely (e.g. show a
completely generic message which might as well be unhelpful and at
worst aggressively misleading).

Log the error locally before returning it to the client, so the info
is at least in the logs.

closes odoo/odoo#57411

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
This commit is contained in:
Xavier Morel
2020-09-10 10:53:31 +00:00
parent 1bd00f4dc2
commit bc683db88c
+2
View File
@@ -2071,6 +2071,7 @@ class ReportController(http.Controller):
"""
requestcontent = json.loads(data)
url, type = requestcontent[0], requestcontent[1]
reportname = '???'
try:
if type in ['qweb-pdf', 'qweb-text']:
converter = 'pdf' if type == 'qweb-pdf' else 'text'
@@ -2109,6 +2110,7 @@ class ReportController(http.Controller):
else:
return
except Exception as e:
_logger.exception("Error while generating report %s", reportname)
se = _serialize_exception(e)
error = {
'code': 200,