跳至内容
菜单
此问题已终结
1 回复
7044 查看

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
28810
4
12月 22
4658
4
3月 21
11064
1
8月 18
5833
2
11月 21
7803