Domain filters
Domains filter records in search, search_read, JSON-RPC, record rules, and list/kanban export windows. Source: sumeru/core/orm/crud_domain.go, domain_json.go.
Shape
A domain is a JSON array of triples [field, operator, value] combined with AND by default.
[["state", "=", "draft"], ["company_id", "=", 1]]Supported operators
| Operator | Meaning |
|---|---|
= | Equal |
!= | Not equal |
in | Value is array of allowed values |
like | SQL LIKE (case-sensitive) |
ilike | SQL ILIKE (case-insensitive) |
=like | Alias for like |
OR composition
Prefix Polish notation: repeat | once per extra OR branch, then list leaf triples.
["|", ["state", "=", "draft"], ["state", "=", "sent"]]Two branches → one | prefix. Three branches → two | prefixes, then three triples.
List search
Workspace list views append an OR-of-ilike domain when ?q= is present, searching Char/Text columns visible in the list view.
Not supported
>,<,>=,<=- Nested boolean trees beyond the OR-prefix pattern above
Plan filters accordingly or post-filter in application code.
Date null checks
For date/datetime fields, use false as the value:
["date_field", "=", false]→ IS NULL["date_field", "!=", false]→ IS NOT NULL
ABAC context tokens
Record rules and some domains substitute runtime tokens (resolved at query time):
| Token | Resolves to |
|---|---|
$uid | Current user id |
$company_id | Active company id |
$company_ids | All companies the user may access |
Used heavily in sys.rule domain_force JSON.
XML-id references
Domains in XML or JSON may reference records by XML id; the engine resolves them via sys.model_data before SQL is built.
Examples
RPC search_read — open sales orders:
{"method": "search_read", "params": {"model": "sale.order", "domain": [["state", "=", "sale"]]}}Text search — name contains "acme" (case-insensitive):
[["name", "ilike", "%acme%"]]Record rule — own company only:
[["company_id", "in", "$company_ids"]]Export window — list/kanban exports apply the window action domain (max 500 rows).