mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-21 22:19:18 +00:00
Minor bugfix (#15210)
* Minor bugfix Bugfix for https://github.com/frappe/erpnext/pull/15170 * Update project.py
This commit is contained in:
@@ -86,7 +86,7 @@ class Project(Document):
|
|||||||
def validate_weights(self):
|
def validate_weights(self):
|
||||||
for task in self.tasks:
|
for task in self.tasks:
|
||||||
if task.task_weight is not None:
|
if task.task_weight is not None:
|
||||||
if task.task_weight > 0:
|
if task.task_weight < 0:
|
||||||
frappe.throw(_("Task weight cannot be negative"))
|
frappe.throw(_("Task weight cannot be negative"))
|
||||||
|
|
||||||
def sync_tasks(self):
|
def sync_tasks(self):
|
||||||
@@ -208,7 +208,7 @@ class Project(Document):
|
|||||||
project=%s""", self.name, as_dict=1)
|
project=%s""", self.name, as_dict=1)
|
||||||
pct_complete = 0
|
pct_complete = 0
|
||||||
for row in weighted_progress:
|
for row in weighted_progress:
|
||||||
pct_complete += row["progress"] * row["task_weight"] / weight_sum
|
pct_complete += row["progress"] * frappe.utils.safe_div(row["task_weight"], weight_sum)
|
||||||
self.percent_complete = flt(flt(pct_complete), 2)
|
self.percent_complete = flt(flt(pct_complete), 2)
|
||||||
if self.percent_complete == 100:
|
if self.percent_complete == 100:
|
||||||
self.status = "Completed"
|
self.status = "Completed"
|
||||||
|
|||||||
Reference in New Issue
Block a user