From 50b3472ebaab53e7cfa79b6a899b52ffbb49a4c9 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Thu, 27 Feb 2020 16:01:47 +0530 Subject: [PATCH 1/2] fix: Journal Entry not being fetched in Bank Reconciliation --- .../doctype/bank_reconciliation/bank_reconciliation.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py index 2436b15dd4..883c4207ea 100644 --- a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py +++ b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py @@ -21,7 +21,7 @@ class BankReconciliation(Document): condition = "" if not self.include_reconciled_entries: - condition = " and (clearance_date is null or clearance_date='0000-00-00')" + condition = "and clearance_date IS NULL or clearance_date='0000-00-00'" journal_entries = frappe.db.sql(""" select @@ -34,11 +34,10 @@ class BankReconciliation(Document): where t2.parent = t1.name and t2.account = %(account)s and t1.docstatus=1 and t1.posting_date >= %(from)s and t1.posting_date <= %(to)s - and ifnull(t1.is_opening, 'No') = 'No' %(condition)s + and ifnull(t1.is_opening, 'No') = 'No' {condition} group by t2.account, t1.name order by t1.posting_date ASC, t1.name DESC - """, {"condition":condition, "account": self.account, "from": self.from_date, "to": self.to_date}, as_dict=1) - + """.format(condition=condition), {"account": self.account, "from": self.from_date, "to": self.to_date}, as_dict=1, debug=1) condition = '' if self.bank_account: From f444f451ac0cf284d1094c13e509ac32805dc8bf Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Thu, 27 Feb 2020 16:04:01 +0530 Subject: [PATCH 2/2] fix: Remove debug statement --- .../doctype/bank_reconciliation/bank_reconciliation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py index 883c4207ea..8900767324 100644 --- a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py +++ b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py @@ -21,7 +21,7 @@ class BankReconciliation(Document): condition = "" if not self.include_reconciled_entries: - condition = "and clearance_date IS NULL or clearance_date='0000-00-00'" + condition = "and (clearance_date IS NULL or clearance_date='0000-00-00')" journal_entries = frappe.db.sql(""" select @@ -37,7 +37,7 @@ class BankReconciliation(Document): and ifnull(t1.is_opening, 'No') = 'No' {condition} group by t2.account, t1.name order by t1.posting_date ASC, t1.name DESC - """.format(condition=condition), {"account": self.account, "from": self.from_date, "to": self.to_date}, as_dict=1, debug=1) + """.format(condition=condition), {"account": self.account, "from": self.from_date, "to": self.to_date}, as_dict=1) condition = '' if self.bank_account: