fix: update the task status from timesheet

This commit is contained in:
Nihantra Patel
2024-04-05 12:27:34 +05:30
parent 8b9079d62e
commit 4e5bc82a17
2 changed files with 6 additions and 2 deletions

View File

@@ -199,8 +199,6 @@ class Task(NestedSet):
self.name,
as_dict=1,
)[0]
if self.status == "Open":
self.status = "Working"
self.total_costing_amount = tl.total_costing_amount
self.total_billing_amount = tl.total_billing_amount
self.actual_time = tl.time

View File

@@ -126,6 +126,12 @@ class Timesheet(Document):
if data.task and data.task not in tasks:
task = frappe.get_doc("Task", data.task)
task.update_time_and_costing()
time_logs_completed = all(tl.completed for tl in self.time_logs if tl.task == task.name)
if time_logs_completed:
task.status = "Completed"
else:
task.status = "Working"
task.save()
tasks.append(data.task)