Se rendre au contenu
Menu
Cette question a été signalée
1 Répondre
6817 Vues

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
Ignorer
Auteur Meilleure réponse

for me adding the field 'datas_fname' in vals worked

Avatar
Ignorer
Publications associées Réponses Vues Activité
11
avr. 23
28459
4
déc. 22
4521
4
mars 21
10768
1
août 18
5700
2
nov. 21
7569