fix: convert goals point to flt (#21840) (#21858)

(cherry picked from commit 4c779300fd)

Co-authored-by: Anurag Mishra <32095923+Anurag810@users.noreply.github.com>
This commit is contained in:
mergify[bot]
2020-05-22 11:43:14 +05:30
committed by GitHub
parent 7b795734e8
commit d2491e403b

View File

@@ -3,7 +3,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe.utils import cint from frappe.utils import cint, flt
from frappe import _ from frappe import _
from frappe.model.document import Document from frappe.model.document import Document
@@ -15,7 +15,7 @@ class AppraisalTemplate(Document):
def check_total_points(self): def check_total_points(self):
total_points = 0 total_points = 0
for d in self.get("goals"): for d in self.get("goals"):
total_points += int(d.per_weightage or 0) total_points += flt(d.per_weightage)
if cint(total_points) != 100: if cint(total_points) != 100:
frappe.throw(_("Sum of points for all goals should be 100. It is {0}").format(total_points)) frappe.throw(_("Sum of points for all goals should be 100. It is {0}").format(total_points))