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)],
            ["ticket_id"],
            ["ticket_id"],
        )
mapped_data = {t["ticket_id"][0]: t["ticket_id_count"] for t in lead_data}
for item in self:
            item.lead_count = mapped_data.get(item.id, 0)

Back to entity