Skip to Content
Menu
This question has been flagged
1 Reply
2364 Views

Hello All

Can anyone help me to reach this question, i had refered accounting module ..there is "check_report" method i have been studying it form many days but i do not getting the point how can we generate a simple report form wizard print button

can anyone help me in detail...

i have refered this link but got no solution

https://www.odoo.com/forum/help-1/question/print-value-of-a-field-in-wizard-to-report-34705

https://www.odoo.com/forum/help-1/question/how-to-generate-a-report-from-a-wizard-22334


Avatar
Discard
Best Answer

You are on the right track. The check_report method in account/wizard/account_report_common.py is inside a a models.TransientModel class named account.common.report. Then it calls print_report. In the same file, this method is not defined. But if you check say account/wizard/account_report_aged_partner_balance.py, you will see that it inherits account.common.partner.report which inherits account.common.report.


Next the print_report method returns this:

self.env['report'].with_context(landscape=True).get_action(self, 'account.report_agedpartnerbalance', data=data)self.env['report'].with_context(landscape=True).get_action(self, 'account.report_agedpartnerbalance', data=data)


Then you can check account/report/account_agent_partner_balance.py which defines a models.Abstractmodel that processes the data and renders the report thru the reder_html method. The name of the Abstractmodel is important as it should be formatted like this: report.module_name.report_name, where report_name is the name of the report defined in your xml.


So, in conclusion, at the minimum, you need to define a TransientModel class then an AbstractModel class with render_html as a method.

Hope that helps.

Avatar
Discard