Skip to content

Commit

Permalink
[UPD] ssi_helpdesk_project
Browse files Browse the repository at this point in the history
* Menambahkan Task Blocked pada helpdesk ticket
  • Loading branch information
andhit-r committed Apr 23, 2024
1 parent 5972f00 commit d246928
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ssi_helpdesk_project/models/helpdesk_ticket.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ class HelpdeskTicket(models.Model):
string="Need Task",
default=False,
)
task_block = fields.Boolean(
string="Task Block",
compute="_compute_task",
store=True,
)
task_ids = fields.Many2many(
string="Tasks",
comodel_name="project.task",
Expand Down Expand Up @@ -99,6 +104,7 @@ class HelpdeskTicket(models.Model):
"task_ids",
"task_ids.stage_id",
"task_ids.state",
"task_ids.kanban_state",
)
def _compute_task(self):
for record in self:
Expand All @@ -108,6 +114,7 @@ def _compute_task(self):
task_draft_count
) = task_open_count = task_done_count = task_pending_count = 0
task_done = False
task_block = False
if record.task_ids:
for task in record.task_ids:
total_task += 1
Expand All @@ -121,6 +128,9 @@ def _compute_task(self):
task_pending_count += 1
else:
task_no_state_count += 1

if task.kanban_state == "blocked":
task_block = True
if total_task == task_done_count:
task_done = True
record.total_task = total_task
Expand All @@ -130,6 +140,7 @@ def _compute_task(self):
record.task_no_state_count = task_no_state_count
record.task_pending_count = task_pending_count
record.task_done = task_done
record.task_block = task_block

@api.depends(
"task_ids",
Expand Down
1 change: 1 addition & 0 deletions ssi_helpdesk_project/views/helpdesk_ticket_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
<group name="task" colspan="4" col="2">
<field name="project_id" />
<field name="need_task" />
<field name="task_block" />
<field name="total_task" />
<field name="task_draft_count" />
<field name="task_open_count" />
Expand Down

0 comments on commit d246928

Please sign in to comment.