fix: task overdue status propagates to project
This commit is contained in:
parent
6fabcdd5b3
commit
e7cf06b3c6
@ -165,6 +165,13 @@ class Task(NestedSet):
|
||||
|
||||
self.update_nsm_model()
|
||||
|
||||
def update_status(self):
|
||||
if self.status not in ('Cancelled', 'Completed'):
|
||||
from datetime import datetime
|
||||
if self.exp_end_date < datetime.now().date():
|
||||
self.date = 'Overdue'
|
||||
self.save()
|
||||
|
||||
@frappe.whitelist()
|
||||
def check_if_child_exists(name):
|
||||
child_tasks = frappe.get_all("Task", filters={"parent_task": name})
|
||||
@ -196,10 +203,9 @@ def set_multiple_status(names, status):
|
||||
task.save()
|
||||
|
||||
def set_tasks_as_overdue():
|
||||
frappe.db.sql("""update tabTask set `status`='Overdue'
|
||||
where exp_end_date is not null
|
||||
and exp_end_date < CURDATE()
|
||||
and `status` not in ('Completed', 'Cancelled')""")
|
||||
tasks = frappe.get_all("Task")
|
||||
for task in tasks:
|
||||
frappe.get_doc("Task", task.name).update_status()
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_children(doctype, parent, task=None, project=None, is_root=False):
|
||||
|
Loading…
x
Reference in New Issue
Block a user