diff --git a/healthcare/healthcare/doctype/nursing_task/nursing_task.py b/healthcare/healthcare/doctype/nursing_task/nursing_task.py index 7734eda549..38001b10f0 100644 --- a/healthcare/healthcare/doctype/nursing_task/nursing_task.py +++ b/healthcare/healthcare/doctype/nursing_task/nursing_task.py @@ -14,16 +14,12 @@ class NursingTask(Document): def before_insert(self): - # set requested start / end self.set_task_schedule() - self.title = "{} - {}".format(_(self.patient), _(self.activity)) - self.age = frappe.get_doc("Patient", self.patient).get_age() def validate(self): if self.status == "Requested": - # auto submit if status is Requested self.docstatus = 1 def on_submit(self): @@ -47,10 +43,11 @@ def on_update_after_submit(self): self.db_set("task_start_time", now_datetime()) elif self.status == "Completed": + task_end_time = now_datetime() self.db_set( { - "task_end_time": now_datetime(), - "task_duration": time_diff_in_seconds(self.task_end_time, self.task_start_time), + "task_end_time": task_end_time, + "task_duration": time_diff_in_seconds(task_end_time, self.task_start_time), } )