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

Module: Helpdesk Management

Entity: helpdesk.ticket.team

Compute Method: _compute_todo_tickets

Inputs Method Outputs
  • id
ticket_model = self.env["helpdesk.ticket"]
result = []
grouped_rows = ticket_model._read_group(
            domain=[("team_id", "in", self.ids), ("closed", "=", False)],
            groupby=["team_id", "user_id", "unattended", "priority"],
            aggregates=["__count"],
        )
for team, user, unattended, priority, count in grouped_rows:
            result.append(
                [
                    team.id if team else False,
                    user.id if user else False,
                    unattended,
                    priority,
                    count,
                ]
            )
for team in self:
            team.todo_ticket_count = sum(r[4] for r in result if r[0] == team.id)
            team.todo_ticket_count_unassigned = sum(
                r[4] for r in result if r[0] == team.id and not r[1]
            )
            team.todo_ticket_count_unattended = sum(
                r[4] for r in result if r[0] == team.id and r[2]
            )
            team.todo_ticket_count_high_priority = sum(
                r[4] for r in result if r[0] == team.id and r[3] == "3"
            )

Back to entity