跳至內容
選單
此問題已被標幟
1 回覆
6804 瀏覽次數

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

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
11
4月 23
28440
4
12月 22
4512
4
3月 21
10722
1
8月 18
5687
2
11月 21
7554