From 4b2f35ed7969eeaf2ab7235623d8c6c26e320ab2 Mon Sep 17 00:00:00 2001 From: nabinhait Date: Tue, 5 Jul 2011 14:25:47 +0530 Subject: [PATCH] fixed issue in update_voucher_outstanding --- accounts/doctype/fiscal_year/fiscal_year.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/accounts/doctype/fiscal_year/fiscal_year.py b/accounts/doctype/fiscal_year/fiscal_year.py index 7db63b2754..6dd4f2ca90 100644 --- a/accounts/doctype/fiscal_year/fiscal_year.py +++ b/accounts/doctype/fiscal_year/fiscal_year.py @@ -165,17 +165,15 @@ class DocType: def update_voucher_outstanding(self): # Clear outstanding self.clear_outstanding() - sql("LOCK TABLE `tabGL Entry` WRITE") - against_voucher = sql("select against_voucher, against_voucher_type from `tabGL Entry` where fiscal_year=%s and is_cancelled='No' and company=%s and ifnull(against_voucher, '') != '' and ifnull(against_voucher_type, '') != '' group by against_voucher, against_voucher_type", (self.doc.name, self.doc.company)) + against_voucher = sql("select against_voucher, against_voucher_type from `tabGL Entry` where fiscal_year=%s and ifnull(is_cancelled, 'No')='No' and company=%s and ifnull(against_voucher, '') != '' and ifnull(against_voucher_type, '') != '' group by against_voucher, against_voucher_type", (self.doc.name, self.doc.company)) for d in against_voucher: # get voucher balance - bal = sql("select sum(debit)-sum(credit) from `tabGL Entry` where against_voucher=%s and against_voucher_type=%s", (d[0], d[1])) + bal = sql("select sum(debit)-sum(credit) from `tabGL Entry` where against_voucher=%s and against_voucher_type=%s and ifnull(is_cancelled, 'No') = 'No'", (d[0], d[1])) bal = bal and flt(bal[0][0]) or 0.0 if d[1] == 'Payable Voucher': bal = -bal # set voucher balance sql("update `tab%s` set outstanding_amount=%s where name='%s'"% (d[1], bal, d[0])) - sql("UNLOCK TABLES") # ==================================================================================== # Generate periods