fix: cannot complete task if dependent task are not completed / cancelled (#20437)

This commit is contained in:
Nabin Hait 2020-01-28 14:08:53 +05:30 committed by GitHub
parent cd8d667861
commit 2bb3a62b1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -56,8 +56,8 @@ class Task(NestedSet):
def validate_status(self):
if self.status!=self.get_db_value("status") and self.status == "Completed":
for d in self.depends_on:
if frappe.db.get_value("Task", d.task, "status") != "Completed":
frappe.throw(_("Cannot close task {0} as its dependant task {1} is not closed.").format(frappe.bold(self.name), frappe.bold(d.task)))
if frappe.db.get_value("Task", d.task, "status") not in ("Completed", "Cancelled"):
frappe.throw(_("Cannot complete task {0} as its dependant task {1} are not ccompleted / cancelled.").format(frappe.bold(self.name), frappe.bold(d.task)))
close_all_assignments(self.doctype, self.name)