Unassign from todo. (#10896)

Unassign from todo when the status is changed to Closed or Cancelled
This commit is contained in:
Shridhar Patil 2017-09-29 15:18:43 +05:30 committed by Rushabh Mehta
parent 367b90e3ae
commit 3f7d96ecba

View File

@ -63,6 +63,12 @@ class Task(Document):
self.check_recursion() self.check_recursion()
self.reschedule_dependent_tasks() self.reschedule_dependent_tasks()
self.update_project() self.update_project()
self.unassign_todo()
def unassign_todo(self):
if self.status == "Closed" or self.status == "Cancelled":
from frappe.desk.form.assign_to import clear
clear(self.doctype, self.name)
def update_total_expense_claim(self): def update_total_expense_claim(self):
self.total_expense_claim = frappe.db.sql("""select sum(total_sanctioned_amount) from `tabExpense Claim` self.total_expense_claim = frappe.db.sql("""select sum(total_sanctioned_amount) from `tabExpense Claim`
@ -171,3 +177,4 @@ def set_tasks_as_overdue():
and exp_end_date < CURDATE() and exp_end_date < CURDATE()
and `status` not in ('Closed', 'Cancelled')""") and `status` not in ('Closed', 'Cancelled')""")