From 4bb0eee41117cf6ea17b7e79428bf7cf58c90011 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 7 Jun 2013 17:06:39 +0530 Subject: [PATCH] [fixes] outstanding for jv --- accounts/doctype/gl_entry/gl_entry.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/accounts/doctype/gl_entry/gl_entry.py b/accounts/doctype/gl_entry/gl_entry.py index 112e449f97..a2ef25a777 100644 --- a/accounts/doctype/gl_entry/gl_entry.py +++ b/accounts/doctype/gl_entry/gl_entry.py @@ -160,13 +160,13 @@ class DocType: def update_outstanding_amt(self): # get final outstanding amt bal = flt(sql("""select sum(debit) - sum(credit) from `tabGL Entry` - where against_voucher=%s and against_voucher_type=%s - and ifnull(is_cancelled,'No') = 'No'""", - (self.doc.against_voucher, self.doc.against_voucher_type))[0][0] or 0.0) - + where against_voucher=%s and against_voucher_type=%s and account = %s + and ifnull(is_cancelled,'No') = 'No'""", (self.doc.against_voucher, + self.doc.against_voucher_type, self.doc.account))[0][0] or 0.0) + if self.doc.against_voucher_type == 'Purchase Invoice': bal = -bal - + elif self.doc.against_voucher_type == "Journal Voucher": against_voucher_amount = flt(webnotes.conn.sql("""select sum(debit) - sum(credit) from `tabGL Entry` where voucher_type = 'Journal Voucher' and voucher_no = %s