Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Account Credit Control

Entity: credit.control.run

Compute Method: _compute_credit_control_count

Inputs Method Outputs
  • id
fetch_data = self.env["credit.control.line"]._read_group(
            domain=[("run_id", "in", self.ids)],
            groupby=["run_id"],
            aggregates=["__count"],
        )
result = {run.id: count for run, count in fetch_data}
for rec in self:
            rec.credit_control_count = result.get(rec.id, 0)
            rec.credit_control_communication_count = len(
                rec.mapped("line_ids.communication_id")
            )

Back to entity