[fix] Compounding error in task weight (#13958)

* [fix] Compounding error in task weight

* [minor] minor changes

* [fix] Requested Changes added
This commit is contained in:
Vishal Dhayagude 2018-05-09 10:42:39 +05:30 committed by Nabin Hait
parent 9fc5ddc26e
commit 3cf0d51e65

View File

@ -75,7 +75,7 @@ class Project(Document):
sum = 0 sum = 0
for task in self.tasks: for task in self.tasks:
if task.task_weight > 0: if task.task_weight > 0:
sum = sum + task.task_weight sum = flt(sum + task.task_weight, task.precision('task_weight'))
if sum > 0 and sum != 1: if sum > 0 and sum != 1:
frappe.throw(_("Total of all task weights should be 1. Please adjust weights of all Project tasks accordingly")) frappe.throw(_("Total of all task weights should be 1. Please adjust weights of all Project tasks accordingly"))