This question has been flagged
1 Reply
4056 Views

Hello, I have some report made in other module for sale.order model.

That report usually I attached it to an email template, but I want reused it in other module to put as message log on the sale orders view. I just need get the pdf but I can not found good example(in old API) to do something that simple.

I have seen some examples in the new API:

report_name = 'external_id_of_your_report'
datas=self.env['report'].get_pdf(self, report_name)

 And I try this:

pdf = self.pool.get('report').get_pdf(cr, uid, sale_order_idreport_name)

But return me "error index out of range".

Help.



Avatar
Discard
Best Answer

Hello,

Please refer below link will help you

https://www.odoo.com/forum/help-1/question/programatically-print-a-report-and-save-it-to-disk-on-server-97624

Avatar
Discard
Author

I made 2 mistakes

- sale_order_id must be inside an array: [sale_order_id]

- I try to use report.name like report.report_name

Ty for your help :)