Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion odoo/addons/base/models/res_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from odoo.osv import expression
from odoo.service.db import check_super
from odoo.tools import partition, collections, frozendict, lazy_property, image_process
from odoo.tools.mail import email_escape_char

_logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -699,7 +700,7 @@ def _get_login_domain(self, login):

@api.model
def _get_email_domain(self, email):
return [('email', '=', email)]
return [('email', '=ilike', email_escape_char(email))]

@api.model
def _get_login_order(self):
Expand Down
7 changes: 7 additions & 0 deletions odoo/addons/base/tests/test_res_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,10 @@ def test_read_group_with_reified_field(self):
# Verify that the read_group is raising an error if reified field is used as groupby
with self.assertRaises(ValueError):
User.read_group([], fnames + [reified_fname], [reified_fname])

def test_get_email_domain(self):
""" Check that _get_email_domain escapes wildcards """
User = self.env['res.users']
self.assertEqual(User._get_email_domain('\\[email protected]'), [('email', '=ilike', '\\\\[email protected]')], "backslashes should be escaped")
self.assertEqual(User._get_email_domain('%[email protected]'), [('email', '=ilike', '\\%[email protected]')], "percents should be escaped")
self.assertEqual(User._get_email_domain('[email protected]'), [('email', '=ilike', '\\[email protected]')], "underscores should be escaped")