Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
14209 Переглядів

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.

Аватар
Відмінити
Найкраща відповідь

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.

Аватар
Відмінити
Автор

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

Related Posts Відповіді Переглядів Дія
2
лист. 23
3142
7
квіт. 21
20514
1
жовт. 20
4886
change search filter Вирішено
2
лист. 16
4240
1
бер. 15
13680