summaryrefslogtreecommitdiff
path: root/addons/mail/models
diff options
context:
space:
mode:
authorDidier (did) <did@odoo.com>2020-12-11 09:34:01 +0000
committerSébastien Theys <seb@odoo.com>2020-12-11 09:34:01 +0000
commit337397eec5570fc9b3938d655a1ec0e4efcd73d9 (patch)
treec4a6dd349a19104985e6b9ce81ff9165aaf1d6f8 /addons/mail/models
parentc54f445ceae72518f787f43213ec78a9a7e1b1eb (diff)
[FIX] mail: clean sub-queries when searching error message
Thread search with `message_has_error` should only return threads containing messages with failure of which the current user is author. Follow up on https://github.com/odoo/odoo/pull/52403 that changed how sub-queries were built. The current fix using `_search` is a non-ideal solution until task-2366651 brings a new domain operator for this use case. task-2409543 closes odoo/odoo#62813 Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Diffstat (limited to 'addons/mail/models')
-rw-r--r--addons/mail/models/mail_thread.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py
index c0dd08b9b64..d694f4f913e 100644
--- a/addons/mail/models/mail_thread.py
+++ b/addons/mail/models/mail_thread.py
@@ -233,7 +233,8 @@ class MailThread(models.AbstractModel):
@api.model
def _search_message_has_error(self, operator, operand):
- return ['&', ('message_ids.has_error', operator, operand), ('message_ids.author_id', '=', self.env.user.partner_id.id)]
+ message_ids = self.env['mail.message']._search([('has_error', operator, operand), ('author_id', '=', self.env.user.partner_id.id)])
+ return [('message_ids', 'in', message_ids)]
def _compute_message_attachment_count(self):
read_group_var = self.env['ir.attachment'].read_group([('res_id', 'in', self.ids), ('res_model', '=', self._name)],