Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
5107 Vistas

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
Descartar
Autor Mejor respuesta

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
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
1
nov 22
4812
0
nov 16
3172
1
abr 15
3877
1
mar 15
5349
0
mar 15
5303