Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

3

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

By
Anil R. Kesariya
on 1/30/15, 1:42 AM 1,292 views

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.

 

3

Anil R. Kesariya

--Anil R. Kesariya--
4321
| 6 5 8
Gandhinagar, India
--Anil R. Kesariya--
ERP Consultant

Key Skill
-
Technical & Functional Expert
Anil R. Kesariya
On 3/23/15, 3:51 AM

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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 1/30/15, 1:42 AM
Seen: 1292 times
Last updated: 3/23/15, 3:51 AM