I want to convert the ir.attachment file in sales module(i.e sales report) into a pdf file using python3 . Can anyone explain how to do it?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- सीआरएम
- e-Commerce
- लेखांकन
- इन्वेंटरी
- PoS
- Project
- MRP
This question has been flagged
Hello Nivetha,
Have you tried the old way?
import base64
pdf = self.env['report'].sudo().get_pdf([invoice.id], 'account.report_invoice')
self.env['ir.attachment'].create({
'name': 'Cats',
'type': 'binary',
'datas': base64.encodestring(pdf),
'res_model': 'account.invoice',
'res_id': invoice.id,
'mimetype': 'application/x-pdf'
})
If you need more explanation go with this tutorial
https://www.cybrosys.com/blog/creating-pdf-attachment-automatically-odoo-13
Or older one:
https://medium.com/hendrasj/how-to-create-attachment-pdf-report-automatically-on-odoo-10-odoo-11-79dd3ad19f23
You will find a way that should work for you also in Odoo 15.
I you found it helpful please vote +1 👍
If it solves completely you problem - mark as best answer 😎
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
1
जून 23
|
4887 | ||
|
3
मार्च 23
|
9984 | ||
|
1
दिस॰ 22
|
2571 | ||
|
1
नव॰ 22
|
5429 | ||
|
2
नव॰ 22
|
2171 |