From bab6c9c0061d6007605ae51762230de67d6aad05 Mon Sep 17 00:00:00 2001 From: Kanchan Chauhan Date: Tue, 14 Feb 2017 14:30:00 +0530 Subject: [PATCH] [Fix] Project perecentage set 0 if no tasks --- erpnext/projects/doctype/project/project.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/erpnext/projects/doctype/project/project.py b/erpnext/projects/doctype/project/project.py index 37fcc113a6..b5ef4bfd76 100644 --- a/erpnext/projects/doctype/project/project.py +++ b/erpnext/projects/doctype/project/project.py @@ -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]