feat(Bank Reconciliation): Redesign (#24273)

Co-authored-by: Nabin Hait <nabinhait@gmail.com>
This commit is contained in:
Mohammad Hasnain Mohsin Rajan
2021-02-22 22:19:47 +05:30
committed by GitHub
parent 866cf70d3a
commit 07f40596bc
61 changed files with 2922 additions and 5018 deletions

View File

@@ -7,9 +7,20 @@ import frappe
def execute():
frappe.reload_doc("accounts", "doctype", "bank_transaction")
frappe.db.sql(""" UPDATE `tabBank Transaction`
SET status = 'Reconciled'
WHERE
status = 'Settled' and (debit = allocated_amount or credit = allocated_amount)
and ifnull(allocated_amount, 0) > 0
""")
bank_transaction_fields = frappe.get_meta("Bank Transaction").get_valid_columns()
if 'debit' in bank_transaction_fields:
frappe.db.sql(""" UPDATE `tabBank Transaction`
SET status = 'Reconciled'
WHERE
status = 'Settled' and (debit = allocated_amount or credit = allocated_amount)
and ifnull(allocated_amount, 0) > 0
""")
elif 'deposit' in bank_transaction_fields:
frappe.db.sql(""" UPDATE `tabBank Transaction`
SET status = 'Reconciled'
WHERE
status = 'Settled' and (deposit = allocated_amount or withdrawal = allocated_amount)
and ifnull(allocated_amount, 0) > 0
""")