تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
6806 أدوات العرض

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.
الصورة الرمزية
إهمال
الكاتب أفضل إجابة

for me adding the field 'datas_fname' in vals worked

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
11
أبريل 23
28448
4
ديسمبر 22
4514
4
مارس 21
10737
1
أغسطس 18
5689
2
نوفمبر 21
7556