Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
According to the "Developer Book >> API" the search command is called like this :
search([('arg1','=','value1')...], offset=0, limit=1000)
Where the second element in the tuple (arg1, arg2, .. ,argN: list of tuples specifying search criteria) is a . . .
search term operator ex: ilike, =, !=
Where can one find the definitive list of those search term operators ?
A definitive list of search term operators can, in fact, be found in the source code (here) can't they?
Each tuple in the search domain needs to have 3 elements, in the form: ('field_name', 'operator', value), where:
- field_name must be a valid name of field of the object model, possibly following many-to-one relationships using dot-notation, e.g 'street' or 'partner_id.country' are valid values.
- operator must be a string with a valid comparison operator from this list:
=, !=, >, >=, <, <=, like, ilike, in, not in, child_of, parent_left, parent_rightThe semantics of most of these operators are obvious. The
child_ofoperator will look for records who are children or grand-children of a given record, according to the semantics of this model (i.e following the relationship field named by
self._parent_name, by default
- value must be a valid value to compare with the values of field_name, depending on its type.
Domain criteria can be combined using 3 logical operators than can be added between tuples:
- '&' (logical AND, default)
- '|' (logical OR)
- '!' (logical NOT)
These are prefix operators and the arity of the '&' and '|' operator is 2, while the arity of the '!' is just 1. Be very careful about this when you combine them the first time.
Here is an example of searching for Partners named ABC from Belgium and Germany whose language is not english ::
The '&' is omitted as it is the default, and of course we could have used '!=' for the language, but what this domain really represents is::
[(name is 'ABC' AND (language is NOT english) AND (country is Belgium OR Germany))]
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
|Asked: 3/17/14, 8:02 AM|
|Seen: 7063 times|
|Last updated: 6/6/17, 2:19 PM|