summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2017-10-09 13:36:20 +0200
committerqsm-odoo <qsm@odoo.com>2017-10-09 15:45:13 +0200
commitcf753a7fdf1739dcf37d2ad74f4c8efb3d4ff3b3 (patch)
treea0e22262d3f5c90f452015831807f117d5343a9f
parent9959f9a00abded5dd40273756ec410c9831b32ca (diff)
[IMP] calendar, event: do not send emails to canceled attendees
This could be considered as a fix but was not able to be done in a stable version as automatic mailing could be used to send non-reminders emails. Or we could simply have users relying on the fact that reminders could make cancelled attendees change their mind.
-rw-r--r--addons/calendar/models/calendar.py2
-rw-r--r--addons/event/models/event.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/addons/calendar/models/calendar.py b/addons/calendar/models/calendar.py
index 6de011b2915..cb5bc6a3db3 100644
--- a/addons/calendar/models/calendar.py
+++ b/addons/calendar/models/calendar.py
@@ -417,7 +417,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 60fa9cfb9f3..c34450aecd8 100644
--- a/addons/event/models/event.py
+++ b/addons/event/models/event.py
@@ -311,7 +311,7 @@ class EventEvent(models.Model):
self.state = 'confirm'
@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)