From bc683db88cc591780d775bb08b1b44791241b59a Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Thu, 10 Sep 2020 10:53:31 +0000 Subject: [PATCH] [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) --- addons/web/controllers/main.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 061c1c57926..623ae92c0f3 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -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,