fix: Set todo status as Closed if task completed (#19059)
This commit is contained in:
parent
87000977d5
commit
74fdfff5b5
@ -9,7 +9,7 @@ import frappe
|
|||||||
from frappe import _, throw
|
from frappe import _, throw
|
||||||
from frappe.utils import add_days, cstr, date_diff, get_link_to_form, getdate
|
from frappe.utils import add_days, cstr, date_diff, get_link_to_form, getdate
|
||||||
from frappe.utils.nestedset import NestedSet
|
from frappe.utils.nestedset import NestedSet
|
||||||
|
from frappe.desk.form.assign_to import close_all_assignments, clear
|
||||||
|
|
||||||
class CircularReferenceError(frappe.ValidationError): pass
|
class CircularReferenceError(frappe.ValidationError): pass
|
||||||
class EndDateCannotBeGreaterThanProjectEndDateError(frappe.ValidationError): pass
|
class EndDateCannotBeGreaterThanProjectEndDateError(frappe.ValidationError): pass
|
||||||
@ -45,8 +45,7 @@ class Task(NestedSet):
|
|||||||
if frappe.db.get_value("Task", d.task, "status") != "Completed":
|
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)))
|
frappe.throw(_("Cannot close task {0} as its dependant task {1} is not closed.").format(frappe.bold(self.name), frappe.bold(d.task)))
|
||||||
|
|
||||||
from frappe.desk.form.assign_to import clear
|
close_all_assignments(self.doctype, self.name)
|
||||||
clear(self.doctype, self.name)
|
|
||||||
|
|
||||||
def validate_progress(self):
|
def validate_progress(self):
|
||||||
if (self.progress or 0) > 100:
|
if (self.progress or 0) > 100:
|
||||||
@ -77,8 +76,9 @@ class Task(NestedSet):
|
|||||||
self.populate_depends_on()
|
self.populate_depends_on()
|
||||||
|
|
||||||
def unassign_todo(self):
|
def unassign_todo(self):
|
||||||
if self.status in ("Completed", "Cancelled"):
|
if self.status == "Completed":
|
||||||
from frappe.desk.form.assign_to import clear
|
close_all_assignments(self.doctype, self.name)
|
||||||
|
if self.status == "Cancelled":
|
||||||
clear(self.doctype, self.name)
|
clear(self.doctype, self.name)
|
||||||
|
|
||||||
def update_total_expense_claim(self):
|
def update_total_expense_claim(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user