[fix] [minor] over-billing validation
diff --git a/controllers/accounts_controller.py b/controllers/accounts_controller.py
index 56ddfd1..f73d16a 100644
--- a/controllers/accounts_controller.py
+++ b/controllers/accounts_controller.py
@@ -389,10 +389,11 @@
where %s=%s and docstatus=1""" % (based_on, self.tname, item_ref_dn, '%s'),
item.fields[item_ref_dn])[0][0]
- max_allowed_amt = webnotes.conn.get_value(ref_dt + " Item",
- item.fields[item_ref_dn], based_on)
+ max_allowed_amt = flt(webnotes.conn.get_value(ref_dt + " Item",
+ item.fields[item_ref_dn], based_on))
- if flt(already_billed) + flt(item.fields[based_on]) > max_allowed_amt:
+ if max_allowed_amt and \
+ flt(already_billed) + flt(item.fields[based_on]) > max_allowed_amt:
webnotes.msgprint(_("Row ")+ cstr(item.idx) + ": " + cstr(item.item_code) +
_(" will be over-billed against mentioned ") + cstr(ref_dt) +
_(". Max allowed " + cstr(based_on) + ": " + cstr(max_allowed_amt)),