Skip to Content
Menu
Dette spørgsmål er blevet anmeldt
1 Svar
6939 Visninger

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
Kassér
Forfatter Bedste svar

for me adding the field 'datas_fname' in vals worked

Avatar
Kassér
Related Posts Besvarelser Visninger Aktivitet
11
apr. 23
28690
4
dec. 22
4596
4
mar. 21
10934
1
aug. 18
5768
2
nov. 21
7716