4dc453d131
* Renamed - Employee Loan Application to Loan Application, Employee Loan to Loan and field Employee Loan Account to Loan Account * Patch added * Dynamic link fields 'applicant' and 'applicant_type' * Member link visible only if domain non profit is active * Modified loan_dashboard * Make Repayment Entry button * Common file loan_common.js for loan and loan_application * repayment schedule rows selection in dialog * validation if repayment amount > total paid amount * repayment only if disbursement is done, make repayment by selecting the installment which falls in the current month * fetch nowdate if disbursement date not found * Rebased with develop * updated non-profit module page * updated patch for renamed fields * dialog to select repayment entries * hidden field to store reschedule paid status * update paid check in loan on journal entry updation * calculate total paid * updated docs * codacy fix
27 lines
1.1 KiB
Python
27 lines
1.1 KiB
Python
import frappe
|
|
from frappe.model.utils.rename_field import rename_field
|
|
|
|
def execute():
|
|
if frappe.db.table_exists("Employee Loan Application") and not frappe.db.table_exists("Loan Application"):
|
|
frappe.rename_doc("DocType", "Employee Loan Application", "Loan Application", force=True)
|
|
|
|
if frappe.db.table_exists("Employee Loan") and not frappe.db.table_exists("Loan"):
|
|
frappe.rename_doc("DocType", "Employee Loan", "Loan", force=True)
|
|
|
|
frappe.reload_doc("hr", "doctype", "loan_application")
|
|
frappe.reload_doc("hr", "doctype", "loan")
|
|
frappe.reload_doc("hr", "doctype", "salary_slip_loan")
|
|
|
|
for doctype in ['Loan', 'Salary Slip Loan']:
|
|
if frappe.db.has_column(doctype, 'employee_loan_account'):
|
|
rename_field(doctype, "employee_loan_account", "loan_account")
|
|
|
|
columns = {'employee': 'applicant', 'employee_name': 'applicant_name'}
|
|
for doctype in ['Loan Application', 'Loan']:
|
|
frappe.db.sql(""" update `tab{doctype}` set applicant_type = 'Employee' """
|
|
.format(doctype=doctype))
|
|
for column, new_column in columns.items():
|
|
if frappe.db.has_column(doctype, column):
|
|
rename_field(doctype, column, new_column)
|
|
|
|
frappe.delete_doc('DocType', doctype) |