def check_total_points(self):
total_points = 0
for d in self.get(“work_changes”):
total_points += int(d.per_weightage or 0)
if cint(total_points) != 0 or 100:
frappe.throw(_("Sum of points for all weightage of work plan changes should be 100. It is {0}").format(total_points))
if total_points is equal to “0” or “100”, it should allow but if total_points is not equal to “0” to “100”, it should not allow.
but my above code is not working. its not allow to save data if total_points is “0”.
@clarkej, it’s not part of python functions, but it’s part of frappe data conversion utilities
Just one historical contextualization
On the beggining of frappe (aka wnframework) it was one CGI framework, and in CGI all the data is handled as text, so you need to have functions to ensure the property conversion between types.