From 2ba035ba6d2784b57e401d1a468fe778f5db0176 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 5 Jan 2021 08:12:30 +0000 Subject: [PATCH] [FW][FIX] calendar: synchronize email_from and author_id when sending email to attendees When emails related to calendar events are sent email_from is set from templates like invite template. Author of those email is however not set and current user is used as default value. In this commit we do as done in templates and try to set event responsible as user, and fall back on current user if not set. This notably solves an issue when using website_calendar. Appointments are done using public user and mails have public user as author. This leads to emails not being accessible or having a false email_from. Task ID-2413792 closes odoo/odoo#64061 X-original-commit: c01d95d371e859002f09520d3a97436f3b3087b8 Signed-off-by: Thibault Delavallee (tde) --- addons/calendar/models/calendar_attendee.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/calendar/models/calendar_attendee.py b/addons/calendar/models/calendar_attendee.py index 513bca28c19..f7240803c2d 100644 --- a/addons/calendar/models/calendar_attendee.py +++ b/addons/calendar/models/calendar_attendee.py @@ -135,6 +135,8 @@ class Attendee(models.Model): attendee.ids, compute_lang=True)[attendee.id] attendee.event_id.with_context(no_document=True).message_notify( + email_from=attendee.event_id.user_id.email_formatted or self.env.user.email_formatted, + author_id=attendee.event_id.user_id.partner_id.id or self.env.user.partner_id.id, body=body, subject=subject, partner_ids=attendee.partner_id.ids,