[FIX] mail: crash on mail resend
- When resending a failed mail the code could crash. The issue is caused by the fact that calling `_get_recipient_data` with the parameter `pids` only, returns as the partners' groups the value `None`. The codes that uses the result of this method consider the groups as an iterable and crash when trying to iterate on a `NoneType`. OPW-1916498 closes odoo/odoo#29408
This commit is contained in:
@@ -68,7 +68,7 @@ class MailResendMessage(models.TransientModel):
|
||||
rdata = []
|
||||
for pid, cid, active, pshare, ctype, notif, groups in self.env['mail.followers']._get_recipient_data(None, False, pids=to_send.ids):
|
||||
if pid and notif == 'email' or not notif:
|
||||
pdata = {'id': pid, 'share': pshare, 'active': active, 'notif': 'email', 'groups': groups}
|
||||
pdata = {'id': pid, 'share': pshare, 'active': active, 'notif': 'email', 'groups': groups or []}
|
||||
if not pshare and notif: # has an user and is not shared, is therefore user
|
||||
rdata.append(dict(pdata, type='user'))
|
||||
elif pshare and notif: # has an user and is shared, is therefore portal
|
||||
|
||||
Reference in New Issue
Block a user