Skip to content

OD108 group-operator-renamed

Field attribute group_operator is renamed aggregator.

Category Severity Series Needs the index
Deprecation Warning 18.0 and later no

What it reports

A field declared with a group_operator argument, in a module of series 18.0 or later.

Why it matters

The attribute sets how list and pivot views aggregate the field when records are grouped, such as sum, avg or max. Odoo 18.0 renamed it aggregator. Odoo 18.0 and 19.0 still accept the old name, with a deprecation warning each time the field is set up. 20.0 no longer knows it: Odoo logs an unknown parameter warning and the field falls back to its default aggregate, a sum for numeric fields and none for the others, so grouped views show other totals with no error.

Modules of earlier series are not checked, since group_operator is the right name there.

Example

models/project_task.py
class ProjectTask(models.Model):
    _inherit = "project.task"

    x_effort_score = fields.Float(group_operator="avg")

From 20.0 the score is summed in grouped views instead of averaged.

models/project_task.py
class ProjectTask(models.Model):
    _inherit = "project.task"

    x_effort_score = fields.Float(aggregator="avg")

Fixing

oscn check --fix renames group_operator= to aggregator=, unless the call also passes aggregator= or unpacks a dict with **.

See fixing findings.

Suppressing

x_effort_score = fields.Float(group_operator="avg")  # odooscan: ignore[OD108]

See suppressing a finding.