brotherton-erpnext/erpnext/patches/v15_0/remove_loan_management_module.py
Anand Baburajan 988d755906
refactor!: removing loan management module (#35522)
* chore: resolving conflicts

* refactor: bank_clearance and add hook for get_payment_entries_for_bank_clearance

* refactor: bank_reconciliation_tool and add hook for get_matching_vouchers_for_bank_reconciliation

* fix: remove sales invoice from bank_reconciliation_doctypes and use hook for voucher clearance

* refactor: remove loan tests from test_bank_transaction

* refactor: bank_clearance_summary and add hook for get_entries_for_bank_clearance_summary

* refactor: removed test_bank_reconciliation_statement

* refactor: bank_reconciliation_statement and add hook for get_amounts_not_reflected_in_system_for_bank_reconciliation_statement

* refactor: add missing hook and patches for module removal and deprecation warning

* refactor: remove loan management translations

* chore: add erpnext tests dependent on lending
2023-06-30 11:02:49 +05:30

49 lines
1.7 KiB
Python

import frappe
def execute():
if "lending" in frappe.get_installed_apps():
return
frappe.delete_doc("Module Def", "Loan Management", ignore_missing=True, force=True)
frappe.delete_doc("Workspace", "Loan Management", ignore_missing=True, force=True)
print_formats = frappe.get_all(
"Print Format", {"module": "Loan Management", "standard": "Yes"}, pluck="name"
)
for print_format in print_formats:
frappe.delete_doc("Print Format", print_format, ignore_missing=True, force=True)
reports = frappe.get_all(
"Report", {"module": "Loan Management", "is_standard": "Yes"}, pluck="name"
)
for report in reports:
frappe.delete_doc("Report", report, ignore_missing=True, force=True)
doctypes = frappe.get_all("DocType", {"module": "Loan Management", "custom": 0}, pluck="name")
for doctype in doctypes:
frappe.delete_doc("DocType", doctype, ignore_missing=True, force=True)
notifications = frappe.get_all(
"Notification", {"module": "Loan Management", "is_standard": 1}, pluck="name"
)
for notifcation in notifications:
frappe.delete_doc("Notification", notifcation, ignore_missing=True, force=True)
for dt in ["Web Form", "Dashboard", "Dashboard Chart", "Number Card"]:
records = frappe.get_all(dt, {"module": "Loan Management", "is_standard": 1}, pluck="name")
for record in records:
frappe.delete_doc(dt, record, ignore_missing=True, force=True)
custom_fields = {
"Loan": ["repay_from_salary"],
"Loan Repayment": ["repay_from_salary", "payroll_payable_account"],
}
for doc, fields in custom_fields.items():
filters = {"dt": doc, "fieldname": ["in", fields]}
records = frappe.get_all("Custom Field", filters=filters, pluck="name")
for record in records:
frappe.delete_doc("Custom Field", record, ignore_missing=True, force=True)