From bb17098172664103979b315db7ebee1447a3dd94 Mon Sep 17 00:00:00 2001 From: Jorge Pinna Puissant Date: Fri, 5 Apr 2019 13:20:21 +0000 Subject: [PATCH] [FIX] mail: only display errors linked to message of current user fine-tuning commit 1120bffb66000649cdfd4dbb4d63faa1b9f23835 Before this commit, the search on message_has_error (used when clicking on a failure notification) only display errors linked to message of the current user. Also, the filter Has_error is true, in the messages view in technical menu only display the message with errors of current user. Now, the filter Has_error is true display the message with errors of all users. The search on message_has_error behave as before. opw-1958813 closes odoo/odoo#32462 Signed-off-by: Jorge Pinna Puissant (jpp) --- addons/mail/models/mail_message.py | 4 ++-- addons/mail/models/mail_thread.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/mail/models/mail_message.py b/addons/mail/models/mail_message.py index b108f3d061e..088e464658a 100644 --- a/addons/mail/models/mail_message.py +++ b/addons/mail/models/mail_message.py @@ -154,8 +154,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')), ('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" + 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" @api.depends('starred_partner_ids') def _get_starred(self): diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py index 9153628b83b..41d35cc706d 100644 --- a/addons/mail/models/mail_thread.py +++ b/addons/mail/models/mail_thread.py @@ -237,7 +237,7 @@ class MailThread(models.AbstractModel): @api.model def _search_message_has_error(self, operator, operand): - return [('message_ids.has_error', operator, operand)] + return ['&', ('message_ids.has_error', operator, operand), ('message_ids.author_id', '=', self.env.user.partner_id.id)] @api.multi def _compute_message_attachment_count(self):