Totals and groups
aggregate_recordsComputes grouped totals, averages, and counts for Odoo records by chosen fields, enabling pivot-style summaries from models like sale.order with optional filters and date grouping.
Instructions
Computes totals/averages/counts grouped by fields (like a pivot table). Example: model "sale.order", group_by ["user_id"], measures ["amount_total:sum"]. Dates can be grouped with ":day", ":week", ":month", ":quarter", ":year".
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"model": "<model>",
"group_by": "<group_by>"
},
"name": "aggregate_records"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| model | Yes | Technical model name, e.g. "sale.order", "res.partner", "crm.lead" | |
| domain | No | Odoo domain, e.g. [["state","=","sale"],["amount_total",">",1000]]. Empty = all records. | |
| group_by | Yes | e.g. ["stage_id"] or ["date_order:month"] | |
| measures | No | e.g. ["amount_total:sum", "product_uom_qty:avg"]. A count is always included. |