Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
6979 Widoki

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.
Awatar
Odrzuć
Autor Najlepsza odpowiedź

for me adding the field 'datas_fname' in vals worked

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
11
kwi 23
28723
4
gru 22
4630
4
mar 21
11006
1
sie 18
5790
2
lis 21
7756