Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
6919 Vizualizări

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.
Imagine profil
Abandonează
Autor Cel mai bun răspuns

for me adding the field 'datas_fname' in vals worked

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
11
apr. 23
28662
4
dec. 22
4580
4
mar. 21
10910
1
aug. 18
5761
2
nov. 21
7686