Hello,
How can I attach, in an email template, a file that is in a binary field?.
Thank you for your help!
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hello,
How can I attach, in an email template, a file that is in a binary field?.
Thank you for your help!
Hi,
You can attach the binary field like this;
self.ensure_one()
mail_template = self.env.ref(
'airport_lounge.agency_reservation_export_email_template',
raise_if_not_found=False)
ctx = {
'default_model': 'reservation.wizard',
'default_use_template': bool(mail_template),
'default_template_id': mail_template.id if mail_template else None,
'default_composition_mode': 'comment',
'mark_so_as_sent': True,
'default_attachment_ids': self.attachment.ids,
'default_email_layout_xmlid': 'mail.mail_notification_layout_with_responsible_signature',
'force_email': True,
}
return {
'name': _('Send Invoice'),
'type': 'ir.actions.act_window',
'view_mode': 'form',
'res_model': 'mail.compose.message',
'views': [(False, 'form')],
'view_id': False,
'target': 'new',
'context': ctx,
}
Regards
Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.
Inscribirse
1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.