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 |
|---|---|---|
|
ticket_model = self.env["helpdesk.ticket"] - fetch_data = ticket_model.read_group( - [("team_id", "in", self.ids), ("closed", "=", False)], - ["team_id", "user_id", "unattended", "priority"], - ["team_id", "user_id", "unattended", "priority"], - lazy=False, + result = [] + grouped_rows = ticket_model._read_group( + domain=[("team_id", "in", self.ids), ("closed", "=", False)], + groupby=["team_id", "user_id", "unattended", "priority"], + aggregates=["__count"], ) - result = [ - [ - data["team_id"][0], - data["user_id"] and data["user_id"][0], - data["unattended"], - data["priority"], - data["__count"], - ] - for data in fetch_data - ] + 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" ) |
|
