diff --git a/erpnext/projects/doctype/task/task.py b/erpnext/projects/doctype/task/task.py index cfed33eab61059c6742b9c95a9cf126500b7ee49..bf0a24381c278830894f225d3bc8c15de9aea134 100755 --- a/erpnext/projects/doctype/task/task.py +++ b/erpnext/projects/doctype/task/task.py @@ -193,8 +193,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 diff --git a/erpnext/projects/doctype/timesheet/timesheet.py b/erpnext/projects/doctype/timesheet/timesheet.py index 7f90ef2304744dcbf9937b1e0f527e205c3c0aca..e3e0d5224b30eb6e19a029998c4f2904aa351d60 100644 --- a/erpnext/projects/doctype/timesheet/timesheet.py +++ b/erpnext/projects/doctype/timesheet/timesheet.py @@ -120,6 +120,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)