Skip to content

Commit

Permalink
Merge PR #259 into 11.0
Browse files Browse the repository at this point in the history
Signed-off-by sbidoul
  • Loading branch information
OCA-git-bot committed Oct 21, 2019
2 parents 42bb138 + 4a1398c commit d969b21
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions report_xlsx/models/ir_report.py
Expand Up @@ -16,9 +16,9 @@ def render_xlsx(self, docids, data):
report_model = self.env.get(report_model_name)
if report_model is None:
raise UserError(_('%s model was not found' % report_model_name))
return report_model.with_context({
'active_model': self.model
}).create_xlsx_report(docids, data)
return report_model.with_context(
active_model=self.model,
).create_xlsx_report(docids, data)

@api.model
def _get_report_from_name(self, report_name):
Expand Down
4 changes: 3 additions & 1 deletion report_xlsx/report/report_xlsx.py
Expand Up @@ -37,7 +37,9 @@ def _get_objs_for_report(self, docids, data):
ids = data["context"].get('active_ids', [])
else:
ids = self.env.context.get('active_ids', [])
return self.env[self.env.context.get('active_model')].browse(ids)
# propagate context anyway
# let it fail explicitely if `active_model` is not there
return self.env[self.env.context['active_model']].browse(ids)

def create_xlsx_report(self, docids, data):
objs = self._get_objs_for_report(docids, data)
Expand Down

0 comments on commit d969b21

Please sign in to comment.