[cleanup] [accounts] delete gl entries on cancellation of accounting transactions
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user