diff --git a/erpnext/projects/doctype/task/task.py b/erpnext/projects/doctype/task/task.py index c03c99b25d5..d6e3b8c77f7 100755 --- a/erpnext/projects/doctype/task/task.py +++ b/erpnext/projects/doctype/task/task.py @@ -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 diff --git a/erpnext/projects/doctype/timesheet/timesheet.py b/erpnext/projects/doctype/timesheet/timesheet.py index 90f436831f9..d2048593eb6 100644 --- a/erpnext/projects/doctype/timesheet/timesheet.py +++ b/erpnext/projects/doctype/timesheet/timesheet.py @@ -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)