[FIX] event: make scheduler respect mail template

Before this commit, the mail scheduler in event bypassed the email_from field
in the selected template, implementing instead its own logic.

With this commit, the scheduler respects the `email_from` field from the mail
template, and only implements its own logic if that field is not set.

Task-3092425

closes odoo/odoo#111462

X-original-commit: ef503e62480c774e8a0d193666cc4cce5ab90282
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
miad-odoo
2023-01-31 15:17:55 +01:00
parent 500c555690
commit f1cb5e6b39
+2 -1
View File
@@ -288,9 +288,10 @@ class EventMailRegistration(models.Model):
author = self.env.user
email_values = {
'email_from': author.email_formatted,
'author_id': author.id,
}
if not reg_mail.scheduler_id.template_ref.email_from:
email_values['email_from'] = author.email_formatted
reg_mail.scheduler_id.template_ref.send_mail(reg_mail.registration_id.id, email_values=email_values)
todo.write({'mail_sent': True})