From 0dbc0c89fdfd1c337d493a6e9e715e03bed90f39 Mon Sep 17 00:00:00 2001 From: Nihantra Patel Date: Thu, 10 Oct 2024 11:23:20 +0530 Subject: [PATCH 1/4] fix: method name and company wise filter in accouts field --- .../loan_management/doctype/loan/test_loan.py | 34 +++++++++---------- .../loan_application/loan_application.py | 2 +- .../doctype/loan_product/loan_product.js | 17 ++++++++++ 3 files changed, 35 insertions(+), 18 deletions(-) diff --git a/lending/loan_management/doctype/loan/test_loan.py b/lending/loan_management/doctype/loan/test_loan.py index bee7ca9a..39bf563f 100644 --- a/lending/loan_management/doctype/loan/test_loan.py +++ b/lending/loan_management/doctype/loan/test_loan.py @@ -24,7 +24,7 @@ unpledge_security, ) from lending.loan_management.doctype.loan_application.loan_application import ( - create_loan_security_assignment, + create_loan_security_assignment_from_loan_application_from_loan_application, ) from lending.loan_management.doctype.loan_disbursement.loan_disbursement import ( get_disbursal_amount, @@ -205,7 +205,7 @@ def test_loan_with_security(self): loan_application = create_loan_application( "_Test Company", self.applicant2, "Stock Loan", pledge, "Repay Over Number of Periods", 12 ) - create_loan_security_assignment(loan_application) + create_loan_security_assignment_from_loan_application_from_loan_application(loan_application) loan = create_loan_with_security( self.applicant2, "Stock Loan", "Repay Over Number of Periods", 12, loan_application @@ -219,7 +219,7 @@ def test_loan_disbursement(self): "_Test Company", self.applicant2, "Stock Loan", pledge, "Repay Over Number of Periods", 12 ) - create_loan_security_assignment(loan_application) + create_loan_security_assignment_from_loan_application_from_loan_application(loan_application) loan = create_loan_with_security( self.applicant2, "Stock Loan", "Repay Over Number of Periods", 12, loan_application @@ -281,7 +281,7 @@ def test_sanctioned_amount_limit(self): loan_application = create_loan_application( "_Test Company", self.applicant3, "Demand Loan", pledge ) - create_loan_security_assignment(loan_application) + create_loan_security_assignment_from_loan_application_from_loan_application(loan_application) loan = create_demand_loan( self.applicant3, "Demand Loan", loan_application, posting_date="2019-10-01" ) @@ -299,7 +299,7 @@ def test_regular_loan_repayment(self): loan_application = create_loan_application( "_Test Company", self.applicant2, "Demand Loan", pledge ) - create_loan_security_assignment(loan_application) + create_loan_security_assignment_from_loan_application_from_loan_application(loan_application) loan = create_demand_loan( self.applicant2, "Demand Loan", loan_application, posting_date="2019-10-01" @@ -360,7 +360,7 @@ def test_loan_closure(self): loan_application = create_loan_application( "_Test Company", self.applicant2, "Demand Loan", pledge ) - create_loan_security_assignment(loan_application) + create_loan_security_assignment_from_loan_application_from_loan_application(loan_application) loan = create_demand_loan( self.applicant2, "Demand Loan", loan_application, posting_date="2019-10-01" ) @@ -416,7 +416,7 @@ def test_loan_repayment_for_term_loan(self): loan_application = create_loan_application( "_Test Company", self.applicant2, "Stock Loan", pledges, "Repay Over Number of Periods", 12 ) - create_loan_security_assignment(loan_application) + create_loan_security_assignment_from_loan_application_from_loan_application(loan_application) loan = create_loan_with_security( self.applicant2, @@ -467,7 +467,7 @@ def test_security_shortfall(self): "_Test Company", self.applicant2, "Stock Loan", pledges, "Repay Over Number of Periods", 12 ) - create_loan_security_assignment(loan_application) + create_loan_security_assignment_from_loan_application_from_loan_application(loan_application) loan = create_loan_with_security( self.applicant2, "Stock Loan", "Repay Over Number of Periods", 12, loan_application @@ -505,7 +505,7 @@ def test_loan_security_release(self): loan_application = create_loan_application( "_Test Company", self.applicant2, "Demand Loan", pledge ) - create_loan_security_assignment(loan_application) + create_loan_security_assignment_from_loan_application_from_loan_application(loan_application) loan = create_demand_loan( self.applicant2, "Demand Loan", loan_application, posting_date="2019-10-01" @@ -565,7 +565,7 @@ def test_partial_loan_security_release(self): loan_application = create_loan_application( "_Test Company", self.applicant2, "Demand Loan", pledge ) - create_loan_security_assignment(loan_application) + create_loan_security_assignment_from_loan_application_from_loan_application(loan_application) loan = create_demand_loan( self.applicant2, "Demand Loan", loan_application, posting_date="2019-10-01" @@ -601,7 +601,7 @@ def test_sanctioned_loan_security_release(self): loan_application = create_loan_application( "_Test Company", self.applicant2, "Demand Loan", pledge ) - create_loan_security_assignment(loan_application) + create_loan_security_assignment_from_loan_application_from_loan_application(loan_application) loan = create_demand_loan( self.applicant2, "Demand Loan", loan_application, posting_date="2019-10-01" @@ -630,7 +630,7 @@ def test_disbursal_check_with_shortfall(self): "_Test Company", self.applicant2, "Stock Loan", pledges, "Repay Over Number of Periods", 12 ) - create_loan_security_assignment(loan_application) + create_loan_security_assignment_from_loan_application_from_loan_application(loan_application) loan = create_loan_with_security( self.applicant2, "Stock Loan", "Repay Over Number of Periods", 12, loan_application @@ -669,7 +669,7 @@ def test_disbursal_check_without_shortfall(self): "_Test Company", self.applicant2, "Stock Loan", pledges, "Repay Over Number of Periods", 12 ) - create_loan_security_assignment(loan_application) + create_loan_security_assignment_from_loan_application_from_loan_application(loan_application) loan = create_loan_with_security( self.applicant2, "Stock Loan", "Repay Over Number of Periods", 12, loan_application @@ -687,7 +687,7 @@ def test_pending_loan_amount_after_closure_request(self): loan_application = create_loan_application( "_Test Company", self.applicant2, "Demand Loan", pledge ) - create_loan_security_assignment(loan_application) + create_loan_security_assignment_from_loan_application_from_loan_application(loan_application) loan = create_demand_loan( self.applicant2, "Demand Loan", loan_application, posting_date="2019-10-01" @@ -737,7 +737,7 @@ def test_partial_unaccrued_interest_payment(self): # loan_application = create_loan_application( # "_Test Company", self.applicant2, "Demand Loan", pledge # ) - # create_loan_security_assignment(loan_application) + # create_loan_security_assignment_from_loan_application_from_loan_application(loan_application) # loan = create_demand_loan( # self.applicant2, "Demand Loan", loan_application, posting_date="2019-10-01" @@ -1294,7 +1294,7 @@ def create_secured_demand_loan(applicant, disbursement_amount=None): pledge = [{"loan_security": "Test Security 1", "qty": 4000.00}] loan_application = create_loan_application("_Test Company", applicant, "Demand Loan", pledge) - create_loan_security_assignment(loan_application) + create_loan_security_assignment_from_loan_application_from_loan_application(loan_application) loan = create_demand_loan(applicant, "Demand Loan", loan_application, posting_date="2019-10-01") loan.submit() @@ -1314,7 +1314,7 @@ def create_loan_scenario_for_penalty(doc): pledge = [{"loan_security": "Test Security 1", "qty": 4000.00}] loan_application = create_loan_application("_Test Company", doc.applicant2, "Demand Loan", pledge) - create_loan_security_assignment(loan_application) + create_loan_security_assignment_from_loan_application(loan_application) loan = create_demand_loan( doc.applicant2, "Demand Loan", loan_application, posting_date="2019-10-01" ) diff --git a/lending/loan_management/doctype/loan_application/loan_application.py b/lending/loan_management/doctype/loan_application/loan_application.py index fc50f29b..0ae4eba4 100644 --- a/lending/loan_management/doctype/loan_application/loan_application.py +++ b/lending/loan_management/doctype/loan_application/loan_application.py @@ -205,7 +205,7 @@ def update_accounts(source_doc, target_doc, source_parent): @frappe.whitelist() -def create_loan_security_assignment(loan_application, loan=None): +def create_loan_security_assignment_from_loan_application(loan_application, loan=None): loan_application_doc = frappe.get_doc("Loan Application", loan_application) lsa = frappe.new_doc("Loan Security Assignment") diff --git a/lending/loan_management/doctype/loan_product/loan_product.js b/lending/loan_management/doctype/loan_product/loan_product.js index 7744ff90..b01154a6 100644 --- a/lending/loan_management/doctype/loan_product/loan_product.js +++ b/lending/loan_management/doctype/loan_product/loan_product.js @@ -30,6 +30,23 @@ frappe.ui.form.on('Loan Product', { }; }); }); + + $.each(["subsidy_adjustment_account", "security_deposit_account", "suspense_collection_account", + "customer_refund_account", "interest_accrued_account", "interest_waiver_account", + "interest_receivable_account", "suspense_interest_income", "broken_period_interest_recovery_account", + "additional_interest_income", "additional_interest_accrued", "additional_interest_receivable", + "additional_interest_suspense", "additional_interest_waiver", "penalty_accrued_account", "penalty_waiver_account", + "penalty_receivable_account", "penalty_suspense_account", "write_off_account", "write_off_recovery_account" + ], function (i, field) { + frm.set_query(field, function () { + return { + "filters": { + "company": frm.doc.company, + "is_group": 0 + } + }; + }); + }); } }); From 6ca16b94a6276b2c23b5ba3291af2a8ce4ad5363 Mon Sep 17 00:00:00 2001 From: Nihantra Patel Date: Thu, 10 Oct 2024 11:28:48 +0530 Subject: [PATCH 2/4] fix: method name and company wise filter in accouts field --- .../loan_management/doctype/loan/test_loan.py | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/lending/loan_management/doctype/loan/test_loan.py b/lending/loan_management/doctype/loan/test_loan.py index 39bf563f..6ba2817c 100644 --- a/lending/loan_management/doctype/loan/test_loan.py +++ b/lending/loan_management/doctype/loan/test_loan.py @@ -24,7 +24,7 @@ unpledge_security, ) from lending.loan_management.doctype.loan_application.loan_application import ( - create_loan_security_assignment_from_loan_application_from_loan_application, + create_loan_security_assignment_from_loan_application, ) from lending.loan_management.doctype.loan_disbursement.loan_disbursement import ( get_disbursal_amount, @@ -205,7 +205,7 @@ def test_loan_with_security(self): loan_application = create_loan_application( "_Test Company", self.applicant2, "Stock Loan", pledge, "Repay Over Number of Periods", 12 ) - create_loan_security_assignment_from_loan_application_from_loan_application(loan_application) + create_loan_security_assignment_from_loan_application(loan_application) loan = create_loan_with_security( self.applicant2, "Stock Loan", "Repay Over Number of Periods", 12, loan_application @@ -219,7 +219,7 @@ def test_loan_disbursement(self): "_Test Company", self.applicant2, "Stock Loan", pledge, "Repay Over Number of Periods", 12 ) - create_loan_security_assignment_from_loan_application_from_loan_application(loan_application) + create_loan_security_assignment_from_loan_application(loan_application) loan = create_loan_with_security( self.applicant2, "Stock Loan", "Repay Over Number of Periods", 12, loan_application @@ -281,7 +281,7 @@ def test_sanctioned_amount_limit(self): loan_application = create_loan_application( "_Test Company", self.applicant3, "Demand Loan", pledge ) - create_loan_security_assignment_from_loan_application_from_loan_application(loan_application) + create_loan_security_assignment_from_loan_application(loan_application) loan = create_demand_loan( self.applicant3, "Demand Loan", loan_application, posting_date="2019-10-01" ) @@ -299,7 +299,7 @@ def test_regular_loan_repayment(self): loan_application = create_loan_application( "_Test Company", self.applicant2, "Demand Loan", pledge ) - create_loan_security_assignment_from_loan_application_from_loan_application(loan_application) + create_loan_security_assignment_from_loan_application(loan_application) loan = create_demand_loan( self.applicant2, "Demand Loan", loan_application, posting_date="2019-10-01" @@ -360,7 +360,7 @@ def test_loan_closure(self): loan_application = create_loan_application( "_Test Company", self.applicant2, "Demand Loan", pledge ) - create_loan_security_assignment_from_loan_application_from_loan_application(loan_application) + create_loan_security_assignment_from_loan_application(loan_application) loan = create_demand_loan( self.applicant2, "Demand Loan", loan_application, posting_date="2019-10-01" ) @@ -416,7 +416,7 @@ def test_loan_repayment_for_term_loan(self): loan_application = create_loan_application( "_Test Company", self.applicant2, "Stock Loan", pledges, "Repay Over Number of Periods", 12 ) - create_loan_security_assignment_from_loan_application_from_loan_application(loan_application) + create_loan_security_assignment_from_loan_application(loan_application) loan = create_loan_with_security( self.applicant2, @@ -467,7 +467,7 @@ def test_security_shortfall(self): "_Test Company", self.applicant2, "Stock Loan", pledges, "Repay Over Number of Periods", 12 ) - create_loan_security_assignment_from_loan_application_from_loan_application(loan_application) + create_loan_security_assignment_from_loan_application(loan_application) loan = create_loan_with_security( self.applicant2, "Stock Loan", "Repay Over Number of Periods", 12, loan_application @@ -505,7 +505,7 @@ def test_loan_security_release(self): loan_application = create_loan_application( "_Test Company", self.applicant2, "Demand Loan", pledge ) - create_loan_security_assignment_from_loan_application_from_loan_application(loan_application) + create_loan_security_assignment_from_loan_application(loan_application) loan = create_demand_loan( self.applicant2, "Demand Loan", loan_application, posting_date="2019-10-01" @@ -565,7 +565,7 @@ def test_partial_loan_security_release(self): loan_application = create_loan_application( "_Test Company", self.applicant2, "Demand Loan", pledge ) - create_loan_security_assignment_from_loan_application_from_loan_application(loan_application) + create_loan_security_assignment_from_loan_application(loan_application) loan = create_demand_loan( self.applicant2, "Demand Loan", loan_application, posting_date="2019-10-01" @@ -601,7 +601,7 @@ def test_sanctioned_loan_security_release(self): loan_application = create_loan_application( "_Test Company", self.applicant2, "Demand Loan", pledge ) - create_loan_security_assignment_from_loan_application_from_loan_application(loan_application) + create_loan_security_assignment_from_loan_application(loan_application) loan = create_demand_loan( self.applicant2, "Demand Loan", loan_application, posting_date="2019-10-01" @@ -630,7 +630,7 @@ def test_disbursal_check_with_shortfall(self): "_Test Company", self.applicant2, "Stock Loan", pledges, "Repay Over Number of Periods", 12 ) - create_loan_security_assignment_from_loan_application_from_loan_application(loan_application) + create_loan_security_assignment_from_loan_application(loan_application) loan = create_loan_with_security( self.applicant2, "Stock Loan", "Repay Over Number of Periods", 12, loan_application @@ -669,7 +669,7 @@ def test_disbursal_check_without_shortfall(self): "_Test Company", self.applicant2, "Stock Loan", pledges, "Repay Over Number of Periods", 12 ) - create_loan_security_assignment_from_loan_application_from_loan_application(loan_application) + create_loan_security_assignment_from_loan_application(loan_application) loan = create_loan_with_security( self.applicant2, "Stock Loan", "Repay Over Number of Periods", 12, loan_application @@ -687,7 +687,7 @@ def test_pending_loan_amount_after_closure_request(self): loan_application = create_loan_application( "_Test Company", self.applicant2, "Demand Loan", pledge ) - create_loan_security_assignment_from_loan_application_from_loan_application(loan_application) + create_loan_security_assignment_from_loan_application(loan_application) loan = create_demand_loan( self.applicant2, "Demand Loan", loan_application, posting_date="2019-10-01" @@ -737,7 +737,7 @@ def test_partial_unaccrued_interest_payment(self): # loan_application = create_loan_application( # "_Test Company", self.applicant2, "Demand Loan", pledge # ) - # create_loan_security_assignment_from_loan_application_from_loan_application(loan_application) + # create_loan_security_assignment_from_loan_application(loan_application) # loan = create_demand_loan( # self.applicant2, "Demand Loan", loan_application, posting_date="2019-10-01" @@ -1294,7 +1294,7 @@ def create_secured_demand_loan(applicant, disbursement_amount=None): pledge = [{"loan_security": "Test Security 1", "qty": 4000.00}] loan_application = create_loan_application("_Test Company", applicant, "Demand Loan", pledge) - create_loan_security_assignment_from_loan_application_from_loan_application(loan_application) + create_loan_security_assignment_from_loan_application(loan_application) loan = create_demand_loan(applicant, "Demand Loan", loan_application, posting_date="2019-10-01") loan.submit() From 0b7375c003c18a4ca78e9e46938bdbf338b21567 Mon Sep 17 00:00:00 2001 From: Nihantra Patel Date: Thu, 10 Oct 2024 15:21:04 +0530 Subject: [PATCH 3/4] fix: method name --- .../loan_management/doctype/loan/test_loan.py | 34 +++++++++---------- .../loan_application/loan_application.js | 2 +- .../loan_application/loan_application.py | 2 +- .../test_loan_disbursement.py | 6 ++-- .../test_loan_interest_accrual.py | 6 ++-- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/lending/loan_management/doctype/loan/test_loan.py b/lending/loan_management/doctype/loan/test_loan.py index 6ba2817c..bee7ca9a 100644 --- a/lending/loan_management/doctype/loan/test_loan.py +++ b/lending/loan_management/doctype/loan/test_loan.py @@ -24,7 +24,7 @@ unpledge_security, ) from lending.loan_management.doctype.loan_application.loan_application import ( - create_loan_security_assignment_from_loan_application, + create_loan_security_assignment, ) from lending.loan_management.doctype.loan_disbursement.loan_disbursement import ( get_disbursal_amount, @@ -205,7 +205,7 @@ def test_loan_with_security(self): loan_application = create_loan_application( "_Test Company", self.applicant2, "Stock Loan", pledge, "Repay Over Number of Periods", 12 ) - create_loan_security_assignment_from_loan_application(loan_application) + create_loan_security_assignment(loan_application) loan = create_loan_with_security( self.applicant2, "Stock Loan", "Repay Over Number of Periods", 12, loan_application @@ -219,7 +219,7 @@ def test_loan_disbursement(self): "_Test Company", self.applicant2, "Stock Loan", pledge, "Repay Over Number of Periods", 12 ) - create_loan_security_assignment_from_loan_application(loan_application) + create_loan_security_assignment(loan_application) loan = create_loan_with_security( self.applicant2, "Stock Loan", "Repay Over Number of Periods", 12, loan_application @@ -281,7 +281,7 @@ def test_sanctioned_amount_limit(self): loan_application = create_loan_application( "_Test Company", self.applicant3, "Demand Loan", pledge ) - create_loan_security_assignment_from_loan_application(loan_application) + create_loan_security_assignment(loan_application) loan = create_demand_loan( self.applicant3, "Demand Loan", loan_application, posting_date="2019-10-01" ) @@ -299,7 +299,7 @@ def test_regular_loan_repayment(self): loan_application = create_loan_application( "_Test Company", self.applicant2, "Demand Loan", pledge ) - create_loan_security_assignment_from_loan_application(loan_application) + create_loan_security_assignment(loan_application) loan = create_demand_loan( self.applicant2, "Demand Loan", loan_application, posting_date="2019-10-01" @@ -360,7 +360,7 @@ def test_loan_closure(self): loan_application = create_loan_application( "_Test Company", self.applicant2, "Demand Loan", pledge ) - create_loan_security_assignment_from_loan_application(loan_application) + create_loan_security_assignment(loan_application) loan = create_demand_loan( self.applicant2, "Demand Loan", loan_application, posting_date="2019-10-01" ) @@ -416,7 +416,7 @@ def test_loan_repayment_for_term_loan(self): loan_application = create_loan_application( "_Test Company", self.applicant2, "Stock Loan", pledges, "Repay Over Number of Periods", 12 ) - create_loan_security_assignment_from_loan_application(loan_application) + create_loan_security_assignment(loan_application) loan = create_loan_with_security( self.applicant2, @@ -467,7 +467,7 @@ def test_security_shortfall(self): "_Test Company", self.applicant2, "Stock Loan", pledges, "Repay Over Number of Periods", 12 ) - create_loan_security_assignment_from_loan_application(loan_application) + create_loan_security_assignment(loan_application) loan = create_loan_with_security( self.applicant2, "Stock Loan", "Repay Over Number of Periods", 12, loan_application @@ -505,7 +505,7 @@ def test_loan_security_release(self): loan_application = create_loan_application( "_Test Company", self.applicant2, "Demand Loan", pledge ) - create_loan_security_assignment_from_loan_application(loan_application) + create_loan_security_assignment(loan_application) loan = create_demand_loan( self.applicant2, "Demand Loan", loan_application, posting_date="2019-10-01" @@ -565,7 +565,7 @@ def test_partial_loan_security_release(self): loan_application = create_loan_application( "_Test Company", self.applicant2, "Demand Loan", pledge ) - create_loan_security_assignment_from_loan_application(loan_application) + create_loan_security_assignment(loan_application) loan = create_demand_loan( self.applicant2, "Demand Loan", loan_application, posting_date="2019-10-01" @@ -601,7 +601,7 @@ def test_sanctioned_loan_security_release(self): loan_application = create_loan_application( "_Test Company", self.applicant2, "Demand Loan", pledge ) - create_loan_security_assignment_from_loan_application(loan_application) + create_loan_security_assignment(loan_application) loan = create_demand_loan( self.applicant2, "Demand Loan", loan_application, posting_date="2019-10-01" @@ -630,7 +630,7 @@ def test_disbursal_check_with_shortfall(self): "_Test Company", self.applicant2, "Stock Loan", pledges, "Repay Over Number of Periods", 12 ) - create_loan_security_assignment_from_loan_application(loan_application) + create_loan_security_assignment(loan_application) loan = create_loan_with_security( self.applicant2, "Stock Loan", "Repay Over Number of Periods", 12, loan_application @@ -669,7 +669,7 @@ def test_disbursal_check_without_shortfall(self): "_Test Company", self.applicant2, "Stock Loan", pledges, "Repay Over Number of Periods", 12 ) - create_loan_security_assignment_from_loan_application(loan_application) + create_loan_security_assignment(loan_application) loan = create_loan_with_security( self.applicant2, "Stock Loan", "Repay Over Number of Periods", 12, loan_application @@ -687,7 +687,7 @@ def test_pending_loan_amount_after_closure_request(self): loan_application = create_loan_application( "_Test Company", self.applicant2, "Demand Loan", pledge ) - create_loan_security_assignment_from_loan_application(loan_application) + create_loan_security_assignment(loan_application) loan = create_demand_loan( self.applicant2, "Demand Loan", loan_application, posting_date="2019-10-01" @@ -737,7 +737,7 @@ def test_partial_unaccrued_interest_payment(self): # loan_application = create_loan_application( # "_Test Company", self.applicant2, "Demand Loan", pledge # ) - # create_loan_security_assignment_from_loan_application(loan_application) + # create_loan_security_assignment(loan_application) # loan = create_demand_loan( # self.applicant2, "Demand Loan", loan_application, posting_date="2019-10-01" @@ -1294,7 +1294,7 @@ def create_secured_demand_loan(applicant, disbursement_amount=None): pledge = [{"loan_security": "Test Security 1", "qty": 4000.00}] loan_application = create_loan_application("_Test Company", applicant, "Demand Loan", pledge) - create_loan_security_assignment_from_loan_application(loan_application) + create_loan_security_assignment(loan_application) loan = create_demand_loan(applicant, "Demand Loan", loan_application, posting_date="2019-10-01") loan.submit() @@ -1314,7 +1314,7 @@ def create_loan_scenario_for_penalty(doc): pledge = [{"loan_security": "Test Security 1", "qty": 4000.00}] loan_application = create_loan_application("_Test Company", doc.applicant2, "Demand Loan", pledge) - create_loan_security_assignment_from_loan_application(loan_application) + create_loan_security_assignment(loan_application) loan = create_demand_loan( doc.applicant2, "Demand Loan", loan_application, posting_date="2019-10-01" ) diff --git a/lending/loan_management/doctype/loan_application/loan_application.js b/lending/loan_management/doctype/loan_application/loan_application.js index e65523b0..51e1ee65 100644 --- a/lending/loan_management/doctype/loan_application/loan_application.js +++ b/lending/loan_management/doctype/loan_application/loan_application.js @@ -81,7 +81,7 @@ frappe.ui.form.on('Loan Application', { } frappe.call({ - method: "lending.loan_management.doctype.loan_application.loan_application.create_loan_security_assignment_from_loan_application", + method: "lending.loan_management.doctype.loan_application.loan_application.create_loan_security_assignment", args: { loan_application: frm.doc.name }, diff --git a/lending/loan_management/doctype/loan_application/loan_application.py b/lending/loan_management/doctype/loan_application/loan_application.py index 0ae4eba4..fc50f29b 100644 --- a/lending/loan_management/doctype/loan_application/loan_application.py +++ b/lending/loan_management/doctype/loan_application/loan_application.py @@ -205,7 +205,7 @@ def update_accounts(source_doc, target_doc, source_parent): @frappe.whitelist() -def create_loan_security_assignment_from_loan_application(loan_application, loan=None): +def create_loan_security_assignment(loan_application, loan=None): loan_application_doc = frappe.get_doc("Loan Application", loan_application) lsa = frappe.new_doc("Loan Security Assignment") diff --git a/lending/loan_management/doctype/loan_disbursement/test_loan_disbursement.py b/lending/loan_management/doctype/loan_disbursement/test_loan_disbursement.py index 41602b5c..7bc8c2a6 100644 --- a/lending/loan_management/doctype/loan_disbursement/test_loan_disbursement.py +++ b/lending/loan_management/doctype/loan_disbursement/test_loan_disbursement.py @@ -30,7 +30,7 @@ set_loan_settings_in_company, ) from lending.loan_management.doctype.loan_application.loan_application import ( - create_loan_security_assignment_from_loan_application, + create_loan_security_assignment, ) from lending.loan_management.doctype.loan_interest_accrual.loan_interest_accrual import ( days_in_year, @@ -85,7 +85,7 @@ def test_loan_topup(self): loan_application = create_loan_application( "_Test Company", self.applicant, "Demand Loan", pledge ) - create_loan_security_assignment_from_loan_application(loan_application) + create_loan_security_assignment(loan_application) loan = create_demand_loan( self.applicant, "Demand Loan", loan_application, posting_date=get_first_day(nowdate()) @@ -134,7 +134,7 @@ def test_loan_topup_with_additional_pledge(self): loan_application = create_loan_application( "_Test Company", self.applicant, "Demand Loan", pledge ) - create_loan_security_assignment_from_loan_application(loan_application) + create_loan_security_assignment(loan_application) loan = create_demand_loan( self.applicant, "Demand Loan", loan_application, posting_date="2019-10-01" diff --git a/lending/loan_management/doctype/loan_interest_accrual/test_loan_interest_accrual.py b/lending/loan_management/doctype/loan_interest_accrual/test_loan_interest_accrual.py index 122fdc8d..587e55fe 100644 --- a/lending/loan_management/doctype/loan_interest_accrual/test_loan_interest_accrual.py +++ b/lending/loan_management/doctype/loan_interest_accrual/test_loan_interest_accrual.py @@ -18,7 +18,7 @@ set_loan_settings_in_company, ) from lending.loan_management.doctype.loan_application.loan_application import ( - create_loan_security_assignment_from_loan_application, + create_loan_security_assignment, ) from lending.loan_management.doctype.loan_interest_accrual.loan_interest_accrual import ( days_in_year, @@ -93,7 +93,7 @@ def test_loan_interest_accural(self): loan_application = create_loan_application( "_Test Company", self.applicant, "Demand Loan", pledge ) - create_loan_security_assignment_from_loan_application(loan_application) + create_loan_security_assignment(loan_application) loan = create_demand_loan( self.applicant, "Demand Loan", loan_application, posting_date=get_first_day(nowdate()) ) @@ -188,7 +188,7 @@ def test_accumulated_amounts(self): loan_application = create_loan_application( "_Test Company", self.applicant, "Demand Loan", pledge ) - create_loan_security_assignment_from_loan_application(loan_application) + create_loan_security_assignment(loan_application) loan = create_demand_loan( self.applicant, "Demand Loan", loan_application, posting_date=get_first_day(nowdate()) ) From d8e07d109100f7ab7cb371be40cf787f10ed5904 Mon Sep 17 00:00:00 2001 From: Nihantra Patel Date: Tue, 15 Oct 2024 10:35:40 +0530 Subject: [PATCH 4/4] fix: method name and company wise filter in accouts field --- lending/loan_management/doctype/loan_product/loan_product.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lending/loan_management/doctype/loan_product/loan_product.js b/lending/loan_management/doctype/loan_product/loan_product.js index b01154a6..5945312d 100644 --- a/lending/loan_management/doctype/loan_product/loan_product.js +++ b/lending/loan_management/doctype/loan_product/loan_product.js @@ -35,8 +35,9 @@ frappe.ui.form.on('Loan Product', { "customer_refund_account", "interest_accrued_account", "interest_waiver_account", "interest_receivable_account", "suspense_interest_income", "broken_period_interest_recovery_account", "additional_interest_income", "additional_interest_accrued", "additional_interest_receivable", - "additional_interest_suspense", "additional_interest_waiver", "penalty_accrued_account", "penalty_waiver_account", - "penalty_receivable_account", "penalty_suspense_account", "write_off_account", "write_off_recovery_account" + "additional_interest_suspense", "additional_interest_waiver", "penalty_accrued_account", + "penalty_waiver_account", "penalty_receivable_account", "penalty_suspense_account", + "write_off_account", "write_off_recovery_account" ], function (i, field) { frm.set_query(field, function () { return {