summaryrefslogtreecommitdiff
path: root/addons/mail/models/mail_thread.py
diff options
context:
space:
mode:
Diffstat (limited to 'addons/mail/models/mail_thread.py')
-rw-r--r--addons/mail/models/mail_thread.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py
index 1fe466d164a..fbdfcbd42e9 100644
--- a/addons/mail/models/mail_thread.py
+++ b/addons/mail/models/mail_thread.py
@@ -707,7 +707,7 @@ class MailThread(models.AbstractModel):
return groups
@api.multi
- def _notify_classify_recipients(self, message, recipients):
+ def _notify_classify_recipients(self, message, recipient_data):
""" Classify recipients to be notified of a message in groups to have
specific rendering depending on their group. For example users could
have access to buttons customers should not have in their emails.
@@ -716,7 +716,7 @@ class MailThread(models.AbstractModel):
method defined here-under.
:param message: mail.message record about to be notified
- :param recipients: res.partner recordset to notify
+ :param recipients: res.partner recordset to notify UPDATE ME
"""
result = {}
@@ -729,11 +729,11 @@ class MailThread(models.AbstractModel):
view_title = _('View')
default_groups = [
- ('user', lambda partner: bool(partner.user_ids) and not any(user.share for user in partner.user_ids), {}),
- ('portal', lambda partner: bool(partner.user_ids) and all(user.share for user in partner.user_ids), {
+ ('user', lambda pdata: pdata['type'] == 'user', {}),
+ ('portal', lambda pdata: pdata['type'] == 'portal', {
'has_button_access': False,
}),
- ('customer', lambda partner: True, {
+ ('customer', lambda pdata: True, {
'has_button_access': False,
})
]
@@ -746,12 +746,12 @@ class MailThread(models.AbstractModel):
'url': access_link,
'title': view_title})
group_data.setdefault('actions', list())
- group_data.setdefault('recipients', self.env['res.partner'])
+ group_data.setdefault('recipients', list())
- for recipient in recipients:
+ for recipient in recipient_data:
for group_name, group_func, group_data in groups:
if group_func(recipient):
- group_data['recipients'] |= recipient
+ group_data['recipients'].append(recipient['id'])
break
for group_name, group_method, group_data in groups:
@@ -759,13 +759,13 @@ class MailThread(models.AbstractModel):
return result
- def _notify_classify_recipients_on_records(self, message, recipients, records=None):
+ def _notify_classify_recipients_on_records(self, message, recipient_data, records=None):
""" Generic wrapper on ``_notify_classify_recipients`` checking mail.thread
inheritance and allowing to call model-specific implementation in a one liner.
This method should not be overridden. """
if records and hasattr(records, '_notify_classify_recipients'):
- return records._notify_classify_recipients(message, recipients)
- return self._notify_classify_recipients(message, recipients)
+ return records._notify_classify_recipients(message, recipient_data)
+ return self._notify_classify_recipients(message, recipient_data)
@api.multi
def _notify_get_reply_to(self, default=None, records=None, company=None, doc_names=None):