Hello Community,
I'm trying to create an pdf attachement to be send with emails using base64:
I've tried this code with some adjustment
pdf = self.env.ref('hr_timesheet.timesheet_report).report_action(self)
self.env['ir.attachment'].create({
'name': 'Cats',
'type': 'binary',
'datas': base64.encodestring(pdf),
'res_model': 'account.invoice',
'res_id': invoice.id
'mimetype': 'application/x-pdf'
})
But it get this issue expected bytes-like object, not dict