From 31a73f2a265a71fa96b30cf74745d756961d976a Mon Sep 17 00:00:00 2001 From: nabinhait Date: Tue, 21 Jun 2011 16:58:01 +0530 Subject: [PATCH] fixed error in update_outstanding through fiscal year --- accounts/doctype/fiscal_year/fiscal_year.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/accounts/doctype/fiscal_year/fiscal_year.py b/accounts/doctype/fiscal_year/fiscal_year.py index 7afb0378bd..fe0f2058b2 100644 --- a/accounts/doctype/fiscal_year/fiscal_year.py +++ b/accounts/doctype/fiscal_year/fiscal_year.py @@ -100,7 +100,9 @@ class DocType: def post_entries(self): sql("LOCK TABLE `tabGL Entry` WRITE") # post each gl entry (batch or complete) - gle = sql("select name, account, debit, credit, is_opening, posting_date from `tabGL Entry` where fiscal_year=%s and ifnull(is_cancelled,'No')='No' and company=%s", (self.doc.name, self.doc.company)) + gle = sql("select name, account, debit, credit, is_opening, posting_date from `tabGL Entry` where fiscal_year=%s and ifnull(is_cancelled,'No')='No' and company=%s + + ", (self.doc.name, self.doc.company)) account_details = {} cnt = 0 @@ -163,7 +165,7 @@ class DocType: # 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 group by against_voucher, against_voucher_type for update", (self.doc.name, self.doc.company)) + 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)) 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]))