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
""")

View File

@@ -0,0 +1,26 @@
# Copyright (c) 2019, Frappe and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.utils.rename_field import rename_field
def execute():
doctypes = [
"Bank Statement Settings",
"Bank Statement Settings Item",
"Bank Statement Transaction Entry",
"Bank Statement Transaction Invoice Item",
"Bank Statement Transaction Payment Item",
"Bank Statement Transaction Settings Item",
"Bank Statement Transaction Settings",
]
for doctype in doctypes:
frappe.delete_doc("DocType", doctype, force=1)
frappe.delete_doc("Page", "bank-reconciliation", force=1)
rename_field("Bank Transaction", "debit", "deposit")
rename_field("Bank Transaction", "credit", "withdrawal")