[IMP] mail: improve default recipients computation

When computing default recipients to mail on some records, take into
account models having a partner_email field. Indeed this method checks
for some commonly-used partner or email fields to find recipients.
This allows to avoid having custom methods in each model. This commit
adds support for partner_email email field used notably in event and
track management.
This commit is contained in:
Thibault Delavallée
2017-03-03 13:02:25 +01:00
parent 26940f8de4
commit 97e6443089
+2
View File
@@ -734,6 +734,8 @@ class MailThread(models.AbstractModel):
recipient_ids.add(record.partner_id.id)
elif 'email_from' in self._fields and record.email_from:
email_to = record.email_from
elif 'partner_email' in self._fields and record.partner_email:
email_to = record.partner_email
elif 'email' in self._fields:
email_to = record.email
res[record.id] = {'partner_ids': list(recipient_ids), 'email_to': email_to, 'email_cc': email_cc}