Skip to content

Domains and context

Domains filter records. Context carries request-scoped options such as language, timezone, active company, and workflow defaults.

Domain conditions

A simple domain is a list of field/operator/value conditions. Conditions are combined with logical AND by default.

{
  "domain": [
    ["move_type", "=", "out_invoice"],
    ["state", "=", "posted"],
    ["invoice_date", ">=", "2026-01-01"]
  ]
}

Common operators include =, !=, >, >=, <, <=, in, not in, like, ilike, child_of, and parent_of.

Logical prefix operators are & for AND, | for OR, and ! for NOT:

{
  "domain": [
    "|",
    ["email", "!=", false],
    ["phone", "!=", false]
  ]
}

Context

{
  "context": {
    "lang": "en_US",
    "tz": "Europe/Berlin",
    "allowed_company_ids": [1, 3]
  },
  "domain": [],
  "fields": ["name"],
  "limit": 20
}

Context can materially change computed values, defaults, translations, company-dependent fields, and method behavior. Preserve the intended company and language explicitly in background jobs.

Pagination and ordering

Use a deterministic order and a bounded limit. Offset pagination is simple, but concurrent writes can shift records between pages. For large synchronizations, page on a stable indexed key such as id or write_date plus id.

{
  "domain": [["id", ">", 10000]],
  "fields": ["name", "write_date"],
  "limit": 500,
  "order": "id asc"
}