Skip to content
Snippets Groups Projects
Commit 355f9906 authored by helly kapatel's avatar helly kapatel Committed by Alexandre Kühn
Browse files

[FIX] mail: do not mention on archive users


Archived users are inactive, so we shouldn't be able to ping them.

Task-2046885

closes odoo/odoo#40814

X-original-commit: 8169e34a
Signed-off-by: default avatarAlexandre Kühn (aku) <aku@odoo.com>
parent 7dcab8a0
No related branches found
No related tags found
No related merge requests found
......@@ -71,10 +71,11 @@ class Partner(models.Model):
""" Return 'limit'-first partners' id, name and email such that the name or email matches a
'search' string. Prioritize users, and then extend the research to all partners. """
search_dom = expression.OR([[('name', 'ilike', search)], [('email', 'ilike', search)]])
search_dom = expression.AND([[('active', '=', True)], search_dom])
fields = ['id', 'name', 'email']
# Search users
domain = expression.AND([[('user_ids.id', '!=', False)], search_dom])
domain = expression.AND([[('user_ids.id', '!=', False), ('user_ids.active', '=', True)], search_dom])
users = self.search_read(domain, fields, limit=limit)
# Search partners if less than 'limit' users found
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment