Skip to Content
Menu
This question has been flagged
1 Atsakyti
6799 Rodiniai

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.
Portretas
Atmesti
Autorius Best Answer

for me adding the field 'datas_fname' in vals worked

Portretas
Atmesti
Related Posts Replies Rodiniai Veikla
11
bal. 23
28437
4
gruod. 22
4511
4
kov. 21
10717
1
rugp. 18
5687
2
lapkr. 21
7552