feat(Bank Reconciliation): Redesign (#24273)
Co-authored-by: Nabin Hait <nabinhait@gmail.com>
This commit is contained in:
committed by
GitHub
parent
866cf70d3a
commit
07f40596bc
@@ -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
|
||||
""")
|
||||
Reference in New Issue
Block a user