Before this commit if another app crashes the "report_xlsx" controller it would go into the exception.
However in the exception the following is called:
_logger.exception("Error while generating report %s", reportname)
As the except clause does not have the "reportname" variable it fails:
Traceback (most recent call last):
File "/home/odoo/src/odoo/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
result = request.dispatch()
File "/home/odoo/src/odoo/odoo/http.py", line 804, in dispatch
r = self._call_function(**self.params)
File "/home/odoo/src/odoo/odoo/http.py", line 359, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/home/odoo/src/odoo/odoo/service/model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "/home/odoo/src/odoo/odoo/http.py", line 348, in checked_call
result = self.endpoint(*a, **kw)
File "/home/odoo/src/odoo/odoo/http.py", line 910, in __call__
return self.method(*args, **kw)
File "/home/odoo/src/odoo/odoo/http.py", line 535, in response_wrap
response = f(*args, **kw)
File "/home/odoo/src/user/report_xlsx/controllers/main.py", line 100, in report_download
_logger.exception("Error while generating report %s", reportname)
Exception
By putting the "reportname" before the try it will always be available
the report handler for xlsx added over here is always returning `true` even if the report being
generated is not xlsx. Due to this, the report handler doesn't check for other report types
at b309d3a99f/addons/web/static/src/webclient/actions/action_service.js (L1019)
and thus doesn't generate any other reports. So if the converter is not xlsx, return false instead of true.
Also, updating the docids and context in the report_routes controller only needs to be done if
the converter is xlsx and not in any other case.
Before this commit, when exception is raised while generating report,
on browser window instead of python traceback nothing was shown
on production environment or werkzeug's "Console locked" message
on development environment.