From f1cb5e6b396ded9a77d00ef00f60ef59bf11a406 Mon Sep 17 00:00:00 2001 From: miad-odoo Date: Mon, 23 Jan 2023 12:12:33 +0000 Subject: [PATCH] [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) --- addons/event/models/event_mail.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/event/models/event_mail.py b/addons/event/models/event_mail.py index 5f4af1c38e7..88cea87792f 100644 --- a/addons/event/models/event_mail.py +++ b/addons/event/models/event_mail.py @@ -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})