Totals by group
odoo_aggregateGroups Odoo records matching a domain by chosen fields and computes totals or counts per group, returning compact grouped rows instead of reading many records.
Instructions
Group the records of one model that match a domain and compute totals per group, e.g. sales per customer per month, and return {model, groupby, measures, count, rows} with one key per groupby item and measure in each row; many2one groups come as {id, name}. Without groupby it returns one row for all matching records. Use it for sums, averages or counts per group instead of reading many records; use odoo_count for a single number and odoo_search for the records themselves.
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>"
},
"name": "odoo_aggregate"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of groups. Values above the model's max_records_per_call (usually 200) are reduced to it. | |
| model | Yes | Technical model name from odoo_list_models, e.g. 'res.partner' or 'sale.order'. | |
| order | No | Sort groups by a groupby item or measure given above, e.g. 'amount_total:sum desc' or '__count desc'. Default: by group. | |
| domain | No | Odoo domain: a list of [field, operator, value] conditions, combined with AND unless prefixed by '|' (OR) or '!' (NOT). A dotted path follows a relation to another available model, e.g. 'country_id.code'. Omit or [] to match every record you can see; archived records are left out unless the domain has a condition on active. Example: [["customer_rank", ">", 0], ["country_id.code", "=", "BE"]]. | |
| groupby | No | Fields to group by. Date and datetime fields need :day, :week, :month, :quarter or :year, e.g. ['partner_id', 'date_order:month']. | |
| measures | No | '__count' for the number of records, or 'field:function' with sum, avg, min, max, count or count_distinct, e.g. 'amount_total:sum'. |