Merge pull request #7737 from KanchanChauhan/project-percentage

[Fix] Project % Completed set to 0 if no tasks
This commit is contained in:
Nabin Hait 2017-02-15 17:28:53 +05:30 committed by GitHub
commit afef62c887

View File

@ -119,6 +119,8 @@ class Project(Document):
def update_percent_complete(self):
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
if (self.percent_complete_method == "Task Completion" and total > 0) or (not self.percent_complete_method and total > 0):
completed = frappe.db.sql("""select count(name) from tabTask where
project=%s and status in ('Closed', 'Cancelled')""", self.name)[0][0]