Odoo Help


This community 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.


[SOLVED] What does "=ilike" in domain operator used for?

Atchuthan - Technical Consultant, Sodexis Inc
on 7/23/14, 1:55 AM 8,772 views

In what scenarios would we need to use '=ilike' in domain operation.

When we create a domain, we have multiple operators available in OpenERP 7 at server/openerp/osv/expression.py

TERM_OPERATORS = ('=', '!=', '<=', '<', '>', '>=', '=?', '=like', '=ilike', 'like', 'not like', 'ilike', 'not ilike', 'in', 'not in',  'child_of')

Can anyone provide me a scenario where we need to use these operators in domain:

1. =?
2. =like
3. =ilike
4. like
5. ilike
6. child_of



René Schuster

--René Schuster--
| 5 5 8
Weinheim, Germany
--René Schuster--

Challenge Everything!

René Schuster
On 7/23/14, 3:49 AM

As prakash says: The i is for case insensitive. While the "= prefix" searches for exact matching. Without the "= prefix", the orm will add % wildcards arround your search term.


[('name', 'like', 'dog')]

This will find recods with name 'dog', 'dogs', 'bulldog', ... but not 'Dog'.

[('name', '=like', 'dog')]

This will find records with name 'dog' (it's almost exactly like the '=' operator).

[('name', 'ilike', 'dog')]

This is the most universal search. It will find records with name 'dog', 'DOGS', 'Bulldog', etc..

['name', '=ilike', 'dog')]

This will find records with name 'dog', 'DOG', 'Dog', 'DOg', DoG', 'dOG', 'doG' and 'dOg'.

They use '=ilike' in your crm/wizard example to match the email case insensitively, so that any capital letter is ignored in the search, since some mail clients allow capitol letters in email addresses, while others doesn't, I think.


Honestly, I have never seen or used the '=?' operator...


I think 'child_of' is somethink like an iterative search for child-relations:

[('parent_id', 'child_of', root_id)]

This will list all children and their children ... and so on for the root_id.





| 5 4 7
Bikaner, India

OpenERP Devloper at SunARC Technology

On 7/23/14, 2:06 AM

ILIKE keyword in PostgreSQL provides case insensitive search.

Reference:-  http://solaimurugan.blogspot.in/2010/07/ilike-operator-in-postgresql.html

so in cases why would we use =ilike?? In CRM/wizard/crm_lead_to_opportunity.py(line no:68) ids = lead_obj.search(cr, uid, [('email_from', '=ilike', email[0]), ('state', '!=', 'done')])

Atchuthan - Technical Consultant, Sodexis Inc
on 7/23/14, 2:23 AM

please see the link http://stackoverflow.com/questions/4752705/case-insensitive-searches-queries based on the link examples need to use 'ilike'. But in the openerp Lead example it check only single record we can also use '=' instead of 'ilike'. Example:- [('email_from', '=', email[0]), ('state', '!=', 'done')]

on 7/23/14, 4:00 AM
Audrius Palenskis
On 12/5/14, 3:17 AM

'=?' operator makes the term TRUE if right statement is None or False otherwise behaves like '='



if right is False or right is None: 

# '=?' is a short-circuit that makes the term TRUE if right is None or False 

query = 'TRUE'

params = [] 


# '=?' behaves like '=' in other cases 

query, params = self.__leaf_to_sql( create_substitution_leaf(eleaf, (left, '=', right), model))

Sample: openerp/addons/base/tests/test_expression.py:120

user_ids = users_obj.search(cr, uid, [('name', 'like', 'test'), ('parent_id', '=?', False)]) 

self.assertEqual(set(user_ids), set([a, b1, b2]), '(x =? False) failed')

As it is shown in example, parent_id cannot be False if value doesn't exist: '=?' returns True or parent_id value

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

3 follower(s)


Asked: 7/23/14, 1:55 AM
Seen: 8772 times
Last updated: 6/2/16, 9:33 AM