Help

3

Why Qweb passing wrong doc_model when we return report from wizard method.

Hello All,

I am facing problems in Qweb report:

Here is my cases.

1) If I am returing report or printing report from methods without parser than it works well.

2) If I have parser of report and returning from method than it is passing wrong model name (wizard model name) on template as doc_model, So having problem on data access of that report.

3) If I want to use combination of both parser and returing report from method for that i have to return data in list of dictionary to access which is not good solution. I want access data from recordset it self.

Is Any one has face this issue? any idea about this issue? Is this limitation or Am I missing somthing.

Regards,

Anil.

 

Avatar
Discard
1 Answer
3
Best Answer

Hi,

Here is the solutions for this, actually its passing, I found in odoo technical document.

We need to override render_html method in our abstract report class.

class ParticularReport(models.AbstractModel):

_name = 'report.module.report_name'

@api.multi

def render_html(self, data=None):

report_obj = self.env['report']

report = report_obj._get_report_from_name('module.report_name')

docargs = {

'doc_ids': self._ids,

'doc_model': report.model,

'docs': self,

}

return report_obj.render('module.report_name', docargs)


Click here for more reference

Avatar
Discard