From de62e33618211fd754ad6e372ac93805cce58770 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Mon, 9 Oct 2017 13:36:20 +0200 Subject: [PATCH] [FIX] calendar, event: do not send emails to canceled attendees Backport of https://github.com/odoo/odoo/commit/cf753a7fdf1739dcf37d2ad74f4c8efb3d4ff3b3 (it was finally considered as a real bug to fix in stable versions from 10.0). opw-769955 opw-814459 Closes https://github.com/odoo/odoo/pull/22882 --- addons/calendar/models/calendar.py | 2 +- addons/event/models/event.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/calendar/models/calendar.py b/addons/calendar/models/calendar.py index 34f0b86b3fb..ab0ce39373e 100644 --- a/addons/calendar/models/calendar.py +++ b/addons/calendar/models/calendar.py @@ -401,7 +401,7 @@ class AlarmManager(models.AbstractModel): result = False if alarm.type == 'email': - result = meeting.attendee_ids._send_mail_to_attendees('calendar.calendar_template_meeting_reminder', force_send=True) + result = meeting.attendee_ids.filtered(lambda r: r.state != 'declined')._send_mail_to_attendees('calendar.calendar_template_meeting_reminder', force_send=True) return result def do_notif_reminder(self, alert): diff --git a/addons/event/models/event.py b/addons/event/models/event.py index 17abb5c1268..81e9e2ff398 100644 --- a/addons/event/models/event.py +++ b/addons/event/models/event.py @@ -272,7 +272,7 @@ class EventEvent(models.Model): return res @api.one - def mail_attendees(self, template_id, force_send=False, filter_func=lambda self: True): + def mail_attendees(self, template_id, force_send=False, filter_func=lambda self: self.state != 'cancel'): for attendee in self.registration_ids.filtered(filter_func): self.env['mail.template'].browse(template_id).send_mail(attendee.id, force_send=force_send)