Skip to content
Snippets Groups Projects
Commit a8ce59ce authored by David Beguin's avatar David Beguin
Browse files

[FIX] mail : Fix blacklist search method

As building a custom filter on 'Blacklist is false' is creating a filter '!= True'
instead of '= False', the assumption that operator must always be '=' is wrong.
This commit inverts the value and operator if the operator is '!='.

Fix for Task ID 33224
PR #27334
parent 6f9a223c
No related branches found
No related tags found
No related merge requests found
......@@ -68,11 +68,14 @@ class MailBlackListMixin(models.AbstractModel):
@api.model
def _search_is_blacklisted(self, operator, value):
# Assumes operator is '=' and value is True or False
# Assumes operator is '=' or '!=' and value is True or False
if not hasattr(self.env[self._name], "_primary_email"):
raise UserError(_('Invalid primary email field on model %s') % self._name)
if operator != '=':
raise NotImplementedError()
if operator == '!=' and isinstance(value, bool):
value = not value
else:
raise NotImplementedError()
[email_field] = self._primary_email
if value:
......
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