aggregate_records
Aggregate Odoo records by group, sum, or count using server-side Postgres queries. Get summarized results without pulling every record.
Instructions
Aggregate Odoo records server-side using Postgres groupby/sum/count. Uses formatted_read_group on Odoo 19+ and read_group on earlier versions.
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 |
|---|---|---|---|
| lazy | No | ||
| limit | No | ||
| model | Yes | ||
| order | No | ||
| domain | No | ||
| offset | No | ||
| group_by | Yes | ||
| instance | No | ||
| measures | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rows | No | Aggregated group rows. | |
| tool | No | Reporting tool name. | |
| error | No | Sanitized error message when success is false. | |
| model | No | ||
| method | No | formatted_read_group (19+) or read_group. | |
| success | Yes | False when the call failed; see error. | |
| group_by | No | ||
| measures | No | ||
| row_count | No | ||
| major_version | No | ||
| fallback_reason | No |