[IMP] mail: mail_template: instead of crashing when sending email based on
templates that have a void email_from, just fall back on the default email_from defined on the mail_message model.
This commit is contained in:
committed by
Thibault Delavallée
parent
2c13ea9c6f
commit
a8d8046cf2
@@ -551,11 +551,12 @@ class mail_template(osv.osv):
|
||||
|
||||
# create a mail_mail based on values, without attachments
|
||||
values = self.generate_email(cr, uid, template_id, res_id, context=context)
|
||||
if not values.get('email_from'):
|
||||
raise UserError(_("Sender email is missing or empty after template rendering. Specify one to deliver your message"))
|
||||
values['recipient_ids'] = [(4, pid) for pid in values.get('partner_ids', list())]
|
||||
attachment_ids = values.pop('attachment_ids', [])
|
||||
attachments = values.pop('attachments', [])
|
||||
# add a protection against void email_from
|
||||
if 'email_from' in values and not values.get('email_from'):
|
||||
values.pop('email_from')
|
||||
msg_id = mail_mail.create(cr, uid, values, context=context)
|
||||
mail = mail_mail.browse(cr, uid, msg_id, context=context)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user