[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:
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user