Skip to Content
Menú
This question has been flagged
1 Respondre
6956 Vistes

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.
Avatar
Descartar
Autor Best Answer

for me adding the field 'datas_fname' in vals worked

Avatar
Descartar
Related Posts Respostes Vistes Activitat
11
d’abr. 23
28699
4
de des. 22
4609
4
de març 21
10957
1
d’ag. 18
5773
2
de nov. 21
7734