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)], fields=["run_id"], groupby=["run_id"]
        )
result = {data["run_id"][0]: data["run_id_count"] for data 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