List of search operators in Odoo

Searching can’t be completed without search operators. They will be helpful when using with domain attributes.

Search operators

Search domain can contain zero or multiple tuples. Each tuple needs to have 3 elements, in the form of ('field_name', 'operator', value).

['|', '|', ('default_code', 'ilike', self), ('name', 'ilike', self), ('barcode', 'ilike', self)]

In this part, we will only need to know all possible value of 'operator‘. This will help us explain correctly our search intent and make Odoo return the correct data set.

List of available term operators:

'=', '!=', '<=', '<', '>', '>=', '=?', '=like', '=ilike', 'like', 'not like', 'ilike', 'not ilike', 'in', 'not in','child_of', 'parent_of'

Logical operators 

Tuples in the domain can be combined using logical operators. There are 3 of them.

  • &‘ (logical AND, default)
  • |‘ (logical OR)
  • !‘ (logical NOT)

The AND operator is used by default if there is no set operator.

Let’s go over some examples to see how their logics.

[('default_code', 'ilike', keyword), ('name', 'ilike', keyword)]
=> ('default_code', 'ilike', keyword) AND ('name', 'ilike', keyword)
['|', ('default_code', 'ilike', keyword), ('name', 'ilike', keyword)]
=> ('default_code', 'ilike', keyword) OR ('name', 'ilike', keyword)
[('name','=','ABC'),'!',('language.code','=','en_US'),'|',('country_id.code','=','be'),('country_id.code','=','de'))


=> (name is 'ABC' AND (language is NOT english) AND (country is Belgium OR Germany))

Leave a Comment

Your email address will not be published. Required fields are marked *

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close