跳至内容
菜单
此问题已终结
1 回复
14139 查看

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!!

相关帖文 回复 查看 活动
2
11月 23
3041
7
4月 21
20361
1
10月 20
4798
2
11月 16
4165
1
3月 15
13622