Skip to content
Snippets Groups Projects
Unverified Commit b466a9ee authored by Xavier Morel's avatar Xavier Morel Committed by Martin Trigaux
Browse files

[FIX] report: Backport of 6d73087d to 9.0

Closes #12131
[FIX] report: don't hide errors in custom reports

If a custom report's render_html raises a KeyError for some
reason, Report.get_html would swallow the exception and fallback
on generic HTML rendering, usually blowing up with unfathomable
errors of missing rendering context data.

Check if a custom report object exists instead of waiting for a
KeyError.
parent 1412a73d
No related branches found
No related tags found
No related merge requests found
......@@ -126,11 +126,11 @@ class Report(osv.Model):
"""
# If the report is using a custom model to render its html, we must use it.
# Otherwise, fallback on the generic html rendering.
try:
report_model_name = 'report.%s' % report_name
particularreport_obj = self.pool[report_model_name]
report_model_name = 'report.%s' % report_name
particularreport_obj = self.pool.get(report_model_name)
if particularreport_obj is not None:
return particularreport_obj.render_html(cr, uid, ids, data=data, context=context)
except KeyError:
else:
report = self._get_report_from_name(cr, uid, report_name)
report_obj = self.pool[report.model]
docs = report_obj.browse(cr, uid, ids, context=context)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment