Skip to Content
Menu
This question has been flagged

I am trying to get all partners that have a certain email address. The issue is, however, that the email addresses in our database are not sanitised, and thus that they can contain capital letters. I can not change this in the database.
As capitalisation does not matter for the email protocol, I would like to search on email address case insensitive.


Code:

models.execute_kw(db, uid, password,
            'res.partner', 'search_read',
            [[['email', operator, email]]],
            {'fields': [], 'limit': 20}

Thank you for your response!

PS: Bonus points to additionally remove sensitivity to points (".") for e.g. Gmail addresses.

Avatar
Discard
Author Best Answer

I wanted to close this ticket as I figured it out (just use the operator =ilike), but I don't have the karma to close my own ticket... Attempting to edit my question results in an error.

I am still looking for a solution for the following problem:


I am trying to get all partners that have a certain email address. The issue is, however, that the email addresses in our database are not sanitised, and thus that they can contain ".", even though this does not matter for google emails. I can not change this in the database.
I would like to search on email address "." insensitive.

e.g. 123.user@gmail.com should be findable via 123user@gmail.com

Code:
models.execute_kw(db, uid, password,
            'res.partner', 'search_read',
            [[['email', '=ilike', email]]],
            {'fields': [], 'limit': 20}
Thank you for your response!

 

Avatar
Discard
Related Posts Replies Views Activity
1
Nov 22
2482
0
Nov 16
2316
1
Apr 15
2947
1
Mar 15
4229
0
Mar 15
4104