1
votes

I have a requirement where a report has to be returned from the controller.

I have all the necessary data needed for calling the report get action method. But from a controller it's not working.

How can I achieve this?

Here is code:

datas = calreport_orm.print_report(cr, uid, [calreport_obj_id], context)
return request.registry.get('report').get_action(cr, uid, [], 'docmarolf_calendar.report_calendar_meeting', data=datas, context=context)
1
Have you tried with following answer ? - Bhavesh Odedra

1 Answers

0
votes

First we have to map/read record of object that we want to display in report.

We may achieve like this way:

if context is None:
    context = {}

ids = [calreport_obj_id] #id of calling report obj

data = calreport_orm.read(cr, uid, ids)[0] #read data from the record id

datas = {
    'ids': ids,
    'model': 'your.modal.name',
    'form': data
}

return self.pool['report'].get_action(cr, uid, [], 'docmarolf_calendar.report_calendar_meeting', data=datas, context=context)