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

Module: Link between Helpdesk and CRM

Entity: helpdesk.ticket

Compute Method: _compute_lead_count

Inputs Method Outputs
  • id
lead_data = self.env["crm.lead"]._read_group(
            [("ticket_id", "in", self.ids)],
            groupby=["ticket_id"],
            aggregates=["__count"],
        )
mapped_data = {ticket.id: count for ticket, count in lead_data}
for item in self:
            item.lead_count = mapped_data.get(item.id, 0)

Back to entity