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
此問題已被標幟
1
回覆
5308
瀏覽次數
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 😎
相關帖文 | 回覆 | 瀏覽次數 | 活動 | |
---|---|---|---|---|
|
1
6月 23
|
5043 | ||
|
3
3月 23
|
10192 | ||
|
1
12月 22
|
2731 | ||
|
1
11月 22
|
5607 | ||
|
2
11月 22
|
2298 |