fix(project): If Project has no Tasks, let the status be set as Completed (#15639)

This commit is contained in:
Shreya Shah 2018-10-10 14:45:40 +05:30 committed by Nabin Hait
parent 14c6ab0ee9
commit 3855156b7d

View File

@ -187,6 +187,7 @@ class Project(Document):
frappe.db.set_value("Sales Order", self.sales_order, "project", self.name)
def update_percent_complete(self):
if not self.tasks: return
total = frappe.db.sql("""select count(name) from tabTask where project=%s""", self.name)[0][0]
if not total and self.percent_complete:
self.percent_complete = 0