Odoo domain is used to select records from a model or database table. It is a very common use case when you need to display a subset of all available records from an action, or to allow only a subset of possible records to be the target of a many2one relation. The way to describe these filters in Odoo is called a domain. It can be defined as a list of operations that are used to filter your data or for searching.
Each condition in a domain contains a field name, operator, and value.
The syntax is as follows:
domain=”[(field_name, ‘operator’, ‘value’)]”
field_name: In this, the field name indicates simply the field name in which you want to assign the domain.
Operator: The list of operators used are given below
* =like’ operator: This operator matches against a pattern. The ‘%’ symbol matches any sequence of characters. It returns the exact case-sensitive search.
Eg: [(‘name’, ‘=like’, ‘odoo’)] – this returns ‘odoo’
*l ike’ operator: This operator matches against a ‘%value%’ pattern, which is similar to ‘ilike’ operator. It also returns a case-sensitive search.
Eg: [(‘name’, ‘=like’, ‘odoo’)] – this returns ‘%odoo%’.
* ilike’ operator: This operator returns exact case insensitive search.
Eg: [(‘name’, ‘=like’, ‘odoo’)] – this returns ‘%Odoo%’, ‘%odoo’
* not like’ and ‘not ilike’ operators: ‘not like’ operator returns result not matched with case sensitive and ‘not ilike’ operator returns result not matched with case insensitive.
* In’ and ‘not in’ operators: These operators are used to check whether the value is present or not present in a list of values.
* child_of’ operator: This operator is used to find children’s values in a hierarchical relation.
#odoo #odoo14 #odoodevelopment #odootutorials #cybrosys #cybrosystutorials
#Set #Domain #Relational #Field #Odoo