> ## Documentation Index
> Fetch the complete documentation index at: https://docs.asteragents.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Odoo Query

> Search, count, and aggregate accessible Odoo records.

Requires the [Odoo integration](/integrations/odoo). This tool is read-only.

Pass `model`, an Odoo JSON `domain`, and `operation` (`search`, `count`, or `group`). Search defaults to `id` and `display_name`; choose `fields` explicitly for other data.

```json theme={null}
{
  "model": "sale.order",
  "domain": [["state", "=", "sale"]],
  "fields": ["id", "name", "partner_id", "amount_total", "currency_id"],
  "limit": 50,
  "order": "date_order desc"
}
```

`limit` is 1–200 (default 50), and `offset` defaults to 0. Follow `next_offset` while `has_more` is true. Queries are bounded pages, not complete datasets; concurrent changes can shift offset pagination.

Use `operation: "count"` for the exact count visible to the API user. For grouped totals, provide `groupby` and `aggregates`:

```json theme={null}
{
  "model": "sale.order",
  "operation": "group",
  "domain": [["state", "=", "sale"]],
  "groupby": ["currency_id", "date_order:month"],
  "aggregates": ["amount_total:sum", "id:count"]
}
```

Aggregates support `sum`, `avg`, `min`, `max`, `count`, and `count_distinct`, with one aggregate per field in each query. Date grouping supports day, week, month, quarter, and year. Group by currency when summing monetary values across currencies. The grouped result is also paginated. Set `groupby: []` for a single total over the entire domain when the units/currency are consistent.

All operations accept `instance` and `context` (`allowed_company_ids`, `lang`, `tz`, `active_test`). Odoo enforces the user's permissions and record rules.
