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

Module: CRM Phone Calls

Entity: res.partner

Compute Method: _compute_phonecall_count

Inputs Method Outputs
  • id
"""Calculate number of phonecalls."""
partner_data = self.env["crm.phonecall"]._read_group(
            domain=[("partner_id", "in", self.ids)],
            groupby=["partner_id"],
            aggregates=["partner_id:count"],
        )
mapped_data = {p[0].id: p[1] for p in partner_data}
for partner in self:
            count = mapped_data.get(partner.id, 0)
            partner.phonecall_count = count

Back to entity