Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
14255 Tampilan

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
Buang
Jawaban Terbai

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
Buang
Penulis

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

Post Terkait Replies Tampilan Aktivitas
2
Nov 23
3205
7
Apr 21
20623
1
Okt 20
4974
2
Nov 16
4302
1
Mar 15
13759