Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
14159 Vizualizări

Hi,

How to do compare ignoring case in search filter? For instance in the below code

ids = self.pool.get('product.product').search(cr, uid, [('name', '=', 'Service'))], context=context)

i am comparing the name of the product with string 'Service'. i want to compare ignoring its case something similar to below

ids = self.pool.get('product.product').search(cr, uid, [('name'.upper(), '=', 'Service'.upper()))], context=context)

I can use 'service'.upper but not 'name'.upper. So how do i compare ignoring its case. Thanks for your time.

Imagine profil
Abandonează
Cel mai bun răspuns

You can use ilike operator instead of = in search domain. It ignores case.

Try this:

ids = self.pool.get('product.product').search(cr, uid, [('name', 'ilike', 'Service'))], context=context)

Hope this is what you are looking for.

Imagine profil
Abandonează
Autor

oh! Thanks sudhir, i actually forgot that option!!

Related Posts Răspunsuri Vizualizări Activitate
2
nov. 23
3063
7
apr. 21
20397
1
oct. 20
4807
2
nov. 16
4177
1
mar. 15
13630