[cleanup] [accounts] delete gl entries on cancellation of accounting transactions
diff --git a/accounts/utils.py b/accounts/utils.py
index e49d4b1..bb1e5d9 100644
--- a/accounts/utils.py
+++ b/accounts/utils.py
@@ -91,15 +91,10 @@
else:
cond.append("""gle.account = "%s" """ % (account, ))
- # join conditional conditions
- cond = " and ".join(cond)
- if cond:
- cond += " and "
-
bal = webnotes.conn.sql("""
SELECT sum(ifnull(debit, 0)) - sum(ifnull(credit, 0))
FROM `tabGL Entry` gle
- WHERE %s ifnull(is_cancelled, 'No') = 'No' """ % (cond, ))[0][0]
+ WHERE %s""" % " and ".join(cond))[0][0]
# if credit account, it should calculate credit - debit
if bal and acc.debit_or_credit == 'Credit':
@@ -236,8 +231,7 @@
set against_voucher_type=null, against_voucher=null,
modified=%s, modified_by=%s
where against_voucher_type=%s and against_voucher=%s
- and voucher_no != ifnull(against_voucher, "")
- and ifnull(is_cancelled, "No")="No" """,
+ and voucher_no != ifnull(against_voucher, '')""",
(now(), webnotes.session.user, ref_type, ref_no))
@webnotes.whitelist()