Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
7110 มุมมอง

Hi, I am trying to add an attachment 

pdf = self.env.ref('india_gst.report_gst_invoice_menu').render_qweb_pdf(picking.out_invoice_ids.id)[0]
vals = {
'res_model': 'account.invoice',
'res_id': picking.out_invoice_ids.id,
'datas': base64.b64encode(pdf),
'name': 'recent_bill.pdf',
'mimetype': 'application/pdf',
}
atac_id = self.env['ir.attachment'].create(vals)


But when I try to download the attachment it downloads some binary file.
อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

for me adding the field 'datas_fname' in vals worked

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
11
เม.ย. 23
28909
4
ธ.ค. 22
4718
4
มี.ค. 21
11155
1
ส.ค. 18
5900
2
พ.ย. 21
7881