diff --git a/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.py b/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.py index 002e312a39..5cbf00b2c6 100644 --- a/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.py +++ b/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.py @@ -342,7 +342,15 @@ def get_pe_matching_query(amount_condition, account_from_to, transaction): def get_je_matching_query(amount_condition, transaction): # get matching journal entry query - cr_or_dr = "credit" if transaction.withdrawal > 0 else "debit" + + company_account = frappe.get_value("Bank Account", transaction.bank_account, "account") + root_type = frappe.get_value("Account", company_account, "root_type") + + if root_type == "Liability": + cr_or_dr = "debit" if transaction.withdrawal > 0 else "credit" + else: + cr_or_dr = "credit" if transaction.withdrawal > 0 else "debit" + return f""" SELECT