Odoo Help

1

How to do compare ignoring case in search filter?

By
vivek
on 5/22/13, 6:52 AM 2,005 views

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.

2

Sudhir Arya (ERP Harbor Consulting Services)

--Sudhir Arya (ERP Harbor Consulting Services)--
11594
| 6 8 8
Ahmedabad, India
--Sudhir Arya (ERP Harbor Consulting Services)--

• Co-Founder & Co-Owner at ERP Harbor Consulting Services

• ERP Consultant / ERP Customization / TechnoFunctional Expert

• Sound knowledge in Python, Odoo (Open ERP), XML, PostgreSQL

• Domain knowledge of Sale Management, Purchase Management, Warehouse Management, Manufacturing, Multi Company Configuration & Management, HR Management, Medical Management, Construction Management, Education Management, Point of Sale, Third Party Integrations

• Positive attitude and quick Learner

• Good analytical skill, quick bug and issue tracing and find the solution

• Good knowledge and experience in payment gateway integration with Odoo

• Ready to accept new challenges

• Active Memeber On Stackoverflow 

LinkedIn

Blog

Stackoverflow

Sudhir Arya
ERP Harbor Consulting Services
skype: 
sudhir@erpharbor.com 
Sudhir Arya (ERP Harbor Consulting Services)
On 5/22/13, 6:58 AM

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

vivek
on 5/22/13, 6:59 AM

Most welcome.

Sudhir Arya (ERP Harbor Consulting Services)
on 5/22/13, 7:05 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)

Stats

Asked: 5/22/13, 6:52 AM
Seen: 2005 times
Last updated: 3/16/15, 8:10 AM