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.utils import add_days, cstr, date_diff, get_link_to_form, getdate
|
||||
from frappe.utils.nestedset import NestedSet
|
||||
|
||||
from frappe.desk.form.assign_to import close_all_assignments, clear
|
||||
|
||||
class CircularReferenceError(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":
|
||||
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
|
||||
clear(self.doctype, self.name)
|
||||
close_all_assignments(self.doctype, self.name)
|
||||
|
||||
def validate_progress(self):
|
||||
if (self.progress or 0) > 100:
|
||||
@ -77,8 +76,9 @@ class Task(NestedSet):
|
||||
self.populate_depends_on()
|
||||
|
||||
def unassign_todo(self):
|
||||
if self.status in ("Completed", "Cancelled"):
|
||||
from frappe.desk.form.assign_to import clear
|
||||
if self.status == "Completed":
|
||||
close_all_assignments(self.doctype, self.name)
|
||||
if self.status == "Cancelled":
|
||||
clear(self.doctype, self.name)
|
||||
|
||||
def update_total_expense_claim(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user