İçereği Atla
Menü
Bu soru işaretlendi
1 Cevapla
14125 Görünümler

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.

Avatar
Vazgeç
En İyi Yanıt

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.

Avatar
Vazgeç
Üretici

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

İlgili Gönderiler Cevaplar Görünümler Aktivite
2
Kas 23
3030
7
Nis 21
20350
1
Eki 20
4791
2
Kas 16
4162
1
Mar 15
13614