fix: pymysql.err.InternalError about t2.bank_account_no due to removal of field from Journal Entry Account table: #20343
diff --git a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py
index 90cdf83..3613a1e 100644
--- a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py
+++ b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py
@@ -21,10 +21,6 @@
if not self.include_reconciled_entries:
condition = " and (clearance_date is null or clearance_date='0000-00-00')"
- account_cond = ""
- if self.bank_account_no:
- account_cond = " and t2.bank_account_no = {0}".format(frappe.db.escape(self.bank_account_no))
-
journal_entries = frappe.db.sql("""
select
"Journal Entry" as payment_document, t1.name as payment_entry,
@@ -36,10 +32,10 @@
where
t2.parent = t1.name and t2.account = %s and t1.docstatus=1
and t1.posting_date >= %s and t1.posting_date <= %s
- and ifnull(t1.is_opening, 'No') = 'No' {0} {1}
+ and ifnull(t1.is_opening, 'No') = 'No' {0}
group by t2.account, t1.name
order by t1.posting_date ASC, t1.name DESC
- """.format(condition, account_cond), (self.bank_account, self.from_date, self.to_date), as_dict=1)
+ """.format(condition), (self.bank_account, self.from_date, self.to_date), as_dict=1)
if self.bank_account_no:
condition = " and bank_account = %(bank_account_no)s"