Merge pull request #1287 from nabinhait/hotfix

Fixes in overbilling validation against DN/PR
This commit is contained in:
Nabin Hait 2014-01-06 23:12:45 -08:00
commit 1e42a3d028

View File

@ -387,6 +387,12 @@ class AccountsController(TransactionBase):
for item in self.doclist.get({"parentfield": "entries"}):
if item.fields.get(item_ref_dn):
ref_amt = flt(webnotes.conn.get_value(ref_dt + " Item",
item.fields[item_ref_dn], based_on), self.precision(based_on, item))
if not ref_amt:
webnotes.msgprint(_("As amount for item") + ": " + item.item_code + _(" in ") +
ref_dt + _(" is zero, system will not check for over-billed"))
else:
already_billed = webnotes.conn.sql("""select sum(%s) from `tab%s`
where %s=%s and docstatus=1 and parent != %s""" %
(based_on, self.tname, item_ref_dn, '%s', '%s'),
@ -395,9 +401,6 @@ class AccountsController(TransactionBase):
total_billed_amt = flt(flt(already_billed) + flt(item.fields[based_on]),
self.precision(based_on, item))
ref_amt = flt(webnotes.conn.get_value(ref_dt + " Item",
item.fields[item_ref_dn], based_on), self.precision(based_on, item))
tolerance, item_tolerance, global_tolerance = get_tolerance_for(item.item_code,
item_tolerance, global_tolerance)