[cleanup] [accounts] delete gl entries on cancellation of accounting transactions

This commit is contained in:
Nabin Hait
2013-08-21 17:47:11 +05:30
parent 4af17a88b0
commit 9b09c95d83
19 changed files with 156 additions and 180 deletions

View File

@@ -287,7 +287,7 @@ class DocType:
"""
Trash accounts and cost centers for this company if no gl entry exists
"""
rec = webnotes.conn.sql("SELECT name from `tabGL Entry` where ifnull(is_cancelled, 'No') = 'No' and company = %s", self.doc.name)
rec = webnotes.conn.sql("SELECT name from `tabGL Entry` where company = %s", self.doc.name)
if not rec:
# delete gl entry
webnotes.conn.sql("delete from `tabGL Entry` where company = %s", self.doc.name)

View File

@@ -362,8 +362,8 @@ class DocType(DocListController):
gl_entries = webnotes.conn.sql("""select `account`,
ifnull(credit, 0) as credit, ifnull(debit, 0) as debit, `against`
from `tabGL Entry`
where company=%s and ifnull(is_cancelled, "No")="No" and
posting_date <= %s %s""" % ("%s", "%s",
where company=%s
and posting_date <= %s %s""" % ("%s", "%s",
from_date and "and posting_date>='%s'" % from_date or ""),
(self.doc.company, to_date or self.to_date), as_dict=1)