From 7ddcfc00fc86d8eba3c404e4a3c2d4acfecf14c8 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Fri, 30 Sep 2022 14:06:06 +0530 Subject: [PATCH] chore: Add patch to update repayment schedule type in loan documents (cherry picked from commit 679b5ed5514b1fc7ee2840326f073764333fe3b6) # Conflicts: # erpnext/patches.txt --- erpnext/loan_management/doctype/loan/test_loan.py | 1 + erpnext/patches.txt | 9 +++++++++ .../patches/v13_0/update_schedule_type_in_loans.py | 14 ++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 erpnext/patches/v13_0/update_schedule_type_in_loans.py diff --git a/erpnext/loan_management/doctype/loan/test_loan.py b/erpnext/loan_management/doctype/loan/test_loan.py index e2b0870c322..11627af53dc 100644 --- a/erpnext/loan_management/doctype/loan/test_loan.py +++ b/erpnext/loan_management/doctype/loan/test_loan.py @@ -1052,6 +1052,7 @@ def create_loan_type( "company": "_Test Company", "loan_name": loan_name, "is_term_loan": is_term_loan, + "repayment_schedule_type": "Monthly as per repayment start date", "maximum_loan_amount": maximum_loan_amount, "rate_of_interest": rate_of_interest, "penalty_interest_rate": penalty_interest_rate, diff --git a/erpnext/patches.txt b/erpnext/patches.txt index b3099644780..dc9e11af6f5 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -370,7 +370,16 @@ erpnext.patches.v13_0.job_card_status_on_hold erpnext.patches.v13_0.add_cost_center_in_loans erpnext.patches.v13_0.show_india_localisation_deprecation_warning erpnext.patches.v13_0.fix_number_and_frequency_for_monthly_depreciation +<<<<<<< HEAD erpnext.patches.v13_0.reset_corrupt_defaults erpnext.patches.v13_0.show_hr_payroll_deprecation_warning erpnext.patches.v13_0.create_accounting_dimensions_for_asset_repair execute:frappe.db.set_value("Naming Series", "Naming Series", {"select_doc_for_series": "", "set_options": "", "prefix": "", "current_value": 0, "user_must_always_select": 0}) +======= +erpnext.patches.v14_0.remove_hr_and_payroll_modules # 20-07-2022 +erpnext.patches.v14_0.fix_crm_no_of_employees +erpnext.patches.v14_0.create_accounting_dimensions_in_subcontracting_doctypes +erpnext.patches.v14_0.fix_subcontracting_receipt_gl_entries +erpnext.patches.v14_0.migrate_remarks_from_gl_to_payment_ledger +erpnext.patches.v13_0.update_schedule_type_in_loans +>>>>>>> 679b5ed551 (chore: Add patch to update repayment schedule type in loan documents) diff --git a/erpnext/patches/v13_0/update_schedule_type_in_loans.py b/erpnext/patches/v13_0/update_schedule_type_in_loans.py new file mode 100644 index 00000000000..e5b5f643604 --- /dev/null +++ b/erpnext/patches/v13_0/update_schedule_type_in_loans.py @@ -0,0 +1,14 @@ +import frappe + + +def execute(): + loan = frappe.qb.DocType("Loan") + loan_type = frappe.qb.DocType("Loan Type") + + frappe.qb.update(loan_type).set( + loan_type.repayment_schedule_type, "Monthly as per repayment start date" + ).where(loan_type.is_term_loan == 1).run() + + frappe.qb.update(loan).set( + loan.repayment_schedule_type, "Monthly as per repayment start date" + ).where(loan.is_term_loan == 1).run()