Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
7019 Lượt xem

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.
Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

for me adding the field 'datas_fname' in vals worked

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
11
thg 4 23
28792
4
thg 12 22
4657
4
thg 3 21
11055
1
thg 8 18
5811
2
thg 11 21
7796