콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
5343 화면

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?

아바타
취소
베스트 답변

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
5050
3
3월 23
10207
1
12월 22
2739
1
11월 22
5623
2
11월 22
2305