From 92a224ee3a6aafaf33911dd9a7cac8f53fc413f7 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Thu, 26 Jul 2018 23:43:17 +0200 Subject: [PATCH] [FIX] event: prefer registration email over partner email As of rev. ca989b6548e93c25f54684e5569ed3998161acce, the default recipients of a model record are used to filter out blacklisted and duplicate emails during a mass-mailing. This can match both either partner_ids or emails, as returned by `message_get_default_recipients()`. The problem with even registration is that a single partner, sometime anonymous (Public User) can be used to register several participants. We therefore need to override `message_get_default_recipients()` to that intent, similarly to what is done in crm.lead since ca989b6548e93c25f54684e5569ed3998161acce. Without this, mass-mailings sent to free event attendees would never be sent, as they would all appear to be duplicates of each other. --- addons/event/models/event.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/addons/event/models/event.py b/addons/event/models/event.py index f11105d5e03..f7db4c8631d 100644 --- a/addons/event/models/event.py +++ b/addons/event/models/event.py @@ -401,6 +401,17 @@ class EventRegistration(models.Model): pass return recipients + @api.multi + def message_get_default_recipients(self): + # Prioritize registration email over partner_id, which may be shared when a single + # partner booked multiple seats + return { + r.id: {'partner_ids': [], + 'email_to': r.email, + 'email_cc': False} + for r in self + } + @api.multi def action_send_badge_email(self): """ Open a window to compose an email, with the template - 'event_badge'