[FIX] event: prefer registration email over partner email

As of rev. ca989b6548, 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
ca989b6548.

Without this, mass-mailings sent to free event attendees would never be
sent, as they would all appear to be duplicates of each other.
This commit is contained in:
Olivier Dony
2018-07-26 23:52:18 +02:00
parent fb31330451
commit 92a224ee3a
+11
View File
@@ -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'