Hello everybody,
I want to create an attachment in event.registration module and pass it to email.template, in order to send a mail.
This is my code
@api.one
def mail_attendees(self, template_id, force_send=False, filter_func=lambda self: True):
for attendee in self.registration_ids.filtered(filter_func):
attachment = self.env['ir.attachment'].create({'name': 'registration.ics',
'datas_fname': 'registration.ics',
'datas': str(file.pdf).encode('base64')})
self.env['mail.template'].browse(template_id).send_mail(attendee.id, force_send=force_send)
How can I pass the attachment to mail template ?
Thank you.
Best regards