Skip to content
Browse files

[FIX] base: split _get_rendering_context to allow different models

Allowing to override the _get_rendering_context and call the new
function (_get_rendreing_context_model) with a different custom model
to render the html.

  • Loading branch information...
jpp-odoo committed Mar 25, 2019
1 parent 7e9a13a commit 0724a9d692cc77a7e5358db4a99ed5ea0776c2da
Showing with 6 additions and 2 deletions.
  1. +6 −2 odoo/addons/base/models/
@@ -721,12 +721,16 @@ def render_qweb_html(self, docids, data=None):
data = self._get_rendering_context(docids, data)
return self.render_template(self.report_name, data), 'html'

def _get_rendering_context_model(self):
report_model_name = 'report.%s' % self.report_name
return self.env.get(report_model_name)

def _get_rendering_context(self, docids, data):
# If the report is using a custom model to render its html, we must use it.
# Otherwise, fallback on the generic html rendering.
report_model_name = 'report.%s' % self.report_name
report_model = self.env.get(report_model_name)
report_model = self._get_rendering_context_model()

data = data and dict(data) or {}

0 comments on commit 0724a9d

Please sign in to comment.
You can’t perform that action at this time.