fix: pymysql.err.InternalError about t2.bank_account_no due to removal of field from Journal Entry Account table: #20343

This commit is contained in:
racitup 2020-01-20 18:56:35 +00:00 committed by Deepesh Garg
parent db00270895
commit 7cda218af3

View File

@ -21,10 +21,6 @@ class BankReconciliation(Document):
if not self.include_reconciled_entries: 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')"
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(""" journal_entries = frappe.db.sql("""
select select
"Journal Entry" as payment_document, t1.name as payment_entry, "Journal Entry" as payment_document, t1.name as payment_entry,
@ -36,10 +32,10 @@ class BankReconciliation(Document):
where where
t2.parent = t1.name and t2.account = %s and t1.docstatus=1 t2.parent = t1.name and t2.account = %s and t1.docstatus=1
and t1.posting_date >= %s and t1.posting_date <= %s 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 group by t2.account, t1.name
order by t1.posting_date ASC, t1.name DESC 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: if self.bank_account_no:
condition = " and bank_account = %(bank_account_no)s" condition = " and bank_account = %(bank_account_no)s"