Community mailing list archives

Re: additional parameter to qweb report

- 07/29/2016 08:27:14

You need to define an AbstractModel for your report. Then when you call your report in odoo it will run the function render_html() for your report.

class AttendeesReport(models.AbstractModel):
    _name = 'report.your_model.report_id'

    def render_html(self, data=None):"Creating Attendees Report")
        report_obj = self.env['report']
        report = report_obj._get_report_from_name('your_model.report_id')

        # docs: the recordset you plan on passing to your report

        docs = self.env['your.model'].browse(self._ids)

        foo = "bar"

        docargs = {
            'doc_model': report.model,
            'docs': docs,
            'foo': foo,
        return report_obj.render('your_model.report_id', docargs)

On 2016-07-29 07:52 AM, shabeer m wrote:
this is not working in my case 

"'NoneType' object has no attribute '__getitem__'" while evaluating
"datas['unit_id'][0]": (<class 'openerp.exceptions.QWebException'>, QWebException(ValueError(u'"\'NoneType\' object has no attribute \'__getitem__\'" while evaluating\n"datas[\'unit_id\'][0]"',),), <traceback object at 0x7f39d64a6ef0>)

On Fri, Jul 29, 2016 at 1:43 PM, Jesús Ventosinos <> wrote:

2016-07-29 8:57 GMT+02:00 shabeer m <>:
hi community,
how do i pass an additional argument to a qweb report and how can i use it in report,

passing variable through wizard

thanks in advance 

Post to:

Post to:

with regards
Shabeer M
Contact : 94 00 7 44 77 6

Post to: