[FIX] mail: only display errors linked to message of current user

The search on message_has_error (used when clicking on a failure notification)
was displaying the failure of all users making it difficult to find your
own mail failure. This fix solve the problem by adding a criteria on message
author_id.
This commit is contained in:
XavierDo
2018-09-05 16:52:44 +02:00
parent 75031d61dd
commit 1120bffb66
+2 -2
View File
@@ -151,8 +151,8 @@ class Message(models.Model):
@api.multi
def _search_has_error(self, operator, operand):
if operator == '=' and operand:
return [('notification_ids.email_status', 'in', ('bounce', 'exception'))]
return ['!', ('notification_ids.email_status', 'in', ('bounce', 'exception'))] # this wont work and will be equivalent to "not in" beacause of orm restrictions. Dont use "has_error = False"
return ['&', ('notification_ids.email_status', 'in', ('bounce', 'exception')), ('author_id', '=', self.env.user.partner_id.id)]
return ['!', '&', ('notification_ids.email_status', 'in', ('bounce', 'exception')), ('author_id', '=', self.env.user.partner_id.id)] # this wont work and will be equivalent to "not in" beacause of orm restrictions. Dont use "has_error = False"
@api.depends('starred_partner_ids')
def _get_starred(self):