From 6140a201f0031c0823f142a6b21da4de1423e111 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Mon, 14 Aug 2023 17:19:14 +0530 Subject: [PATCH] chore: formatting and test fixes --- lending/hooks.py | 2 +- .../doctype/days_past_due_log/days_past_due_log.py | 2 +- .../doctype/days_past_due_log/test_days_past_due_log.py | 2 +- lending/loan_management/doctype/loan/loan.py | 5 +++-- lending/loan_management/doctype/loan/loan_dashboard.py | 2 +- .../doctype/loan_application/loan_application.py | 2 +- .../doctype/loan_application/test_loan_application.py | 3 +-- .../loan_asset_classification_range.py | 2 +- .../loan_balance_adjustment/loan_balance_adjustment.py | 2 +- .../doctype/loan_charge_reference/loan_charge_reference.py | 2 +- lending/loan_management/doctype/loan_charges/loan_charges.py | 2 +- .../doctype/loan_disbursement/loan_disbursement.py | 2 +- .../doctype/loan_disbursement/loan_disbursement_dashboard.py | 2 +- .../doctype/loan_interest_accrual/loan_interest_accrual.py | 2 +- .../loan_interest_accrual/test_loan_interest_accrual.py | 2 +- .../loan_management/doctype/loan_repayment/loan_repayment.py | 3 ++- .../loan_repayment_schedule/loan_repayment_schedule.py | 2 +- .../loan_repayment_schedule/test_loan_repayment_schedule.py | 2 +- .../doctype/loan_restructure/loan_restructure.py | 3 ++- .../doctype/loan_restructure/loan_restructure_dashboard.py | 2 +- .../doctype/loan_restructure/test_loan_restructure.py | 2 +- .../loan_restructure_limit_log/loan_restructure_limit_log.py | 2 +- .../test_loan_restructure_limit_log.py | 2 +- .../doctype/loan_security_deposit/loan_security_deposit.py | 2 +- .../loan_security_deposit/test_loan_security_deposit.py | 2 +- .../process_asset_classification.py | 2 +- lending/patches.txt | 2 +- lending/patches/v15_0/create_custom_fields.py | 2 +- 28 files changed, 32 insertions(+), 30 deletions(-) diff --git a/lending/hooks.py b/lending/hooks.py index 4ebeb9ac..5442033d 100644 --- a/lending/hooks.py +++ b/lending/hooks.py @@ -132,7 +132,7 @@ ], "monthly_long": [ "lending.loan_management.doctype.process_loan_interest_accrual.process_loan_interest_accrual.process_loan_interest_accrual_for_demand_loans", - "lending.loan_management.doctype.process_loan_restructure_limit.process_loan_restructure_limit.calculate_monthly_restructure_limit" + "lending.loan_management.doctype.process_loan_restructure_limit.process_loan_restructure_limit.calculate_monthly_restructure_limit", ], } diff --git a/lending/loan_management/doctype/days_past_due_log/days_past_due_log.py b/lending/loan_management/doctype/days_past_due_log/days_past_due_log.py index 7574f8fc..8d8077f9 100644 --- a/lending/loan_management/doctype/days_past_due_log/days_past_due_log.py +++ b/lending/loan_management/doctype/days_past_due_log/days_past_due_log.py @@ -6,4 +6,4 @@ class DaysPastDueLog(Document): - pass \ No newline at end of file + pass diff --git a/lending/loan_management/doctype/days_past_due_log/test_days_past_due_log.py b/lending/loan_management/doctype/days_past_due_log/test_days_past_due_log.py index bd8c6de4..5f670208 100644 --- a/lending/loan_management/doctype/days_past_due_log/test_days_past_due_log.py +++ b/lending/loan_management/doctype/days_past_due_log/test_days_past_due_log.py @@ -6,4 +6,4 @@ class TestDaysPastDueLog(FrappeTestCase): - pass \ No newline at end of file + pass diff --git a/lending/loan_management/doctype/loan/loan.py b/lending/loan_management/doctype/loan/loan.py index 1f38b3cc..4196de50 100644 --- a/lending/loan_management/doctype/loan/loan.py +++ b/lending/loan_management/doctype/loan/loan.py @@ -12,6 +12,7 @@ import erpnext from erpnext.accounts.doctype.journal_entry.journal_entry import get_payment_entry from erpnext.controllers.accounts_controller import AccountsController + from lending.loan_management.doctype.loan_security_unpledge.loan_security_unpledge import ( get_pledged_security_qty, ) @@ -136,7 +137,7 @@ def update_draft_schedule(self): "repayment_start_date": self.repayment_start_date, "posting_date": self.posting_date, "loan_amount": self.loan_amount, - "monthly_repayment_amount": self.monthly_repayment_amount + "monthly_repayment_amount": self.monthly_repayment_amount, } ) schedule.save() @@ -871,4 +872,4 @@ def move_unpaid_interest_to_suspense_ledger( ) jv.flags.ignore_mandatory = True - jv.submit() \ No newline at end of file + jv.submit() diff --git a/lending/loan_management/doctype/loan/loan_dashboard.py b/lending/loan_management/doctype/loan/loan_dashboard.py index 1b2f935a..48eae0e3 100644 --- a/lending/loan_management/doctype/loan/loan_dashboard.py +++ b/lending/loan_management/doctype/loan/loan_dashboard.py @@ -18,4 +18,4 @@ def get_data(): {"items": ["Loan Repayment", "Loan Interest Accrual", "Loan Write Off", "Loan Restructure"]}, {"items": ["Loan Security Unpledge", "Days Past Due Log", "Journal Entry", "Sales Invoice"]}, ], - } \ No newline at end of file + } diff --git a/lending/loan_management/doctype/loan_application/loan_application.py b/lending/loan_management/doctype/loan_application/loan_application.py index 1ca469a3..ca678d3b 100644 --- a/lending/loan_management/doctype/loan_application/loan_application.py +++ b/lending/loan_management/doctype/loan_application/loan_application.py @@ -259,4 +259,4 @@ def get_proposed_pledge(securities): proposed_pledges["maximum_loan_amount"] = maximum_loan_amount - return proposed_pledges \ No newline at end of file + return proposed_pledges diff --git a/lending/loan_management/doctype/loan_application/test_loan_application.py b/lending/loan_management/doctype/loan_application/test_loan_application.py index 89fb1366..0f1fbe16 100644 --- a/lending/loan_management/doctype/loan_application/test_loan_application.py +++ b/lending/loan_management/doctype/loan_application/test_loan_application.py @@ -26,8 +26,7 @@ def setUp(self): "Loan Account - _TC", "Interest Income Account - _TC", "Penalty Income Account - _TC", - "Repay Over Number of Periods", - 18, + repayment_schedule_type="Monthly as per repayment start date", ) self.applicant = make_employee("kate_loan@loan.com", "_Test Company") self.create_loan_application() diff --git a/lending/loan_management/doctype/loan_asset_classification_range/loan_asset_classification_range.py b/lending/loan_management/doctype/loan_asset_classification_range/loan_asset_classification_range.py index 0df968da..884e54b2 100644 --- a/lending/loan_management/doctype/loan_asset_classification_range/loan_asset_classification_range.py +++ b/lending/loan_management/doctype/loan_asset_classification_range/loan_asset_classification_range.py @@ -6,4 +6,4 @@ class LoanAssetClassificationRange(Document): - pass \ No newline at end of file + pass diff --git a/lending/loan_management/doctype/loan_balance_adjustment/loan_balance_adjustment.py b/lending/loan_management/doctype/loan_balance_adjustment/loan_balance_adjustment.py index cfd5fd3d..50871777 100644 --- a/lending/loan_management/doctype/loan_balance_adjustment/loan_balance_adjustment.py +++ b/lending/loan_management/doctype/loan_balance_adjustment/loan_balance_adjustment.py @@ -151,4 +151,4 @@ def make_gl_entries(self, cancel=0, adv_adj=0): gle_map.append(self.get_gl_dict(company_entry)) if gle_map: - make_gl_entries(gle_map, cancel=cancel, adv_adj=adv_adj, merge_entries=False) \ No newline at end of file + make_gl_entries(gle_map, cancel=cancel, adv_adj=adv_adj, merge_entries=False) diff --git a/lending/loan_management/doctype/loan_charge_reference/loan_charge_reference.py b/lending/loan_management/doctype/loan_charge_reference/loan_charge_reference.py index c40bf7e2..5d7b5fbe 100644 --- a/lending/loan_management/doctype/loan_charge_reference/loan_charge_reference.py +++ b/lending/loan_management/doctype/loan_charge_reference/loan_charge_reference.py @@ -6,4 +6,4 @@ class LoanChargeReference(Document): - pass \ No newline at end of file + pass diff --git a/lending/loan_management/doctype/loan_charges/loan_charges.py b/lending/loan_management/doctype/loan_charges/loan_charges.py index 55a29108..23afc573 100644 --- a/lending/loan_management/doctype/loan_charges/loan_charges.py +++ b/lending/loan_management/doctype/loan_charges/loan_charges.py @@ -6,4 +6,4 @@ class LoanCharges(Document): - pass \ No newline at end of file + pass diff --git a/lending/loan_management/doctype/loan_disbursement/loan_disbursement.py b/lending/loan_management/doctype/loan_disbursement/loan_disbursement.py index 3b7bc378..21201963 100644 --- a/lending/loan_management/doctype/loan_disbursement/loan_disbursement.py +++ b/lending/loan_management/doctype/loan_disbursement/loan_disbursement.py @@ -335,4 +335,4 @@ def get_disbursal_amount(loan, on_current_security_price=0): def get_maximum_amount_as_per_pledged_security(loan): - return flt(frappe.db.get_value("Loan Security Pledge", {"loan": loan}, "sum(maximum_loan_value)")) \ No newline at end of file + return flt(frappe.db.get_value("Loan Security Pledge", {"loan": loan}, "sum(maximum_loan_value)")) diff --git a/lending/loan_management/doctype/loan_disbursement/loan_disbursement_dashboard.py b/lending/loan_management/doctype/loan_disbursement/loan_disbursement_dashboard.py index b44d661c..329b4abe 100644 --- a/lending/loan_management/doctype/loan_disbursement/loan_disbursement_dashboard.py +++ b/lending/loan_management/doctype/loan_disbursement/loan_disbursement_dashboard.py @@ -6,4 +6,4 @@ def get_data(): "items": ["Loan Security Deposit"], }, ], - } \ No newline at end of file + } diff --git a/lending/loan_management/doctype/loan_interest_accrual/loan_interest_accrual.py b/lending/loan_management/doctype/loan_interest_accrual/loan_interest_accrual.py index 810cbd78..4267bec8 100644 --- a/lending/loan_management/doctype/loan_interest_accrual/loan_interest_accrual.py +++ b/lending/loan_management/doctype/loan_interest_accrual/loan_interest_accrual.py @@ -379,4 +379,4 @@ def get_per_day_interest(principal_amount, rate_of_interest, posting_date=None): return flt( (principal_amount * rate_of_interest) / (days_in_year(get_datetime(posting_date).year) * 100) - ) \ No newline at end of file + ) 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 2dbd3b1f..fb77548b 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 @@ -243,4 +243,4 @@ def setup_asset_classification_ranges(company): }, ) - company_doc.save() \ No newline at end of file + company_doc.save() diff --git a/lending/loan_management/doctype/loan_repayment/loan_repayment.py b/lending/loan_management/doctype/loan_repayment/loan_repayment.py index 77e80c86..fb348000 100644 --- a/lending/loan_management/doctype/loan_repayment/loan_repayment.py +++ b/lending/loan_management/doctype/loan_repayment/loan_repayment.py @@ -9,6 +9,7 @@ import erpnext from erpnext.accounts.general_ledger import make_gl_entries from erpnext.controllers.accounts_controller import AccountsController + from lending.loan_management.doctype.loan.loan import update_all_linked_loan_customer_npa_status from lending.loan_management.doctype.loan_interest_accrual.loan_interest_accrual import ( get_last_accrual_date, @@ -1207,4 +1208,4 @@ def get_outstanding_invoices(loan, posting_date): "due_date": ("<=", posting_date), }, fields=["name as voucher_no", "outstanding_amount"], - ) \ No newline at end of file + ) diff --git a/lending/loan_management/doctype/loan_repayment_schedule/loan_repayment_schedule.py b/lending/loan_management/doctype/loan_repayment_schedule/loan_repayment_schedule.py index e3c1ded6..4bf307b3 100644 --- a/lending/loan_management/doctype/loan_repayment_schedule/loan_repayment_schedule.py +++ b/lending/loan_management/doctype/loan_repayment_schedule/loan_repayment_schedule.py @@ -172,4 +172,4 @@ def get_monthly_repayment_amount(loan_amount, rate_of_interest, repayment_period ) else: monthly_repayment_amount = math.ceil(flt(loan_amount) / repayment_periods) - return monthly_repayment_amount \ No newline at end of file + return monthly_repayment_amount diff --git a/lending/loan_management/doctype/loan_repayment_schedule/test_loan_repayment_schedule.py b/lending/loan_management/doctype/loan_repayment_schedule/test_loan_repayment_schedule.py index ea0b2d9a..bbacc17b 100644 --- a/lending/loan_management/doctype/loan_repayment_schedule/test_loan_repayment_schedule.py +++ b/lending/loan_management/doctype/loan_repayment_schedule/test_loan_repayment_schedule.py @@ -6,4 +6,4 @@ class TestLoanRepaymentSchedule(FrappeTestCase): - pass \ No newline at end of file + pass diff --git a/lending/loan_management/doctype/loan_restructure/loan_restructure.py b/lending/loan_management/doctype/loan_restructure/loan_restructure.py index 7635b693..38a7afc2 100644 --- a/lending/loan_management/doctype/loan_restructure/loan_restructure.py +++ b/lending/loan_management/doctype/loan_restructure/loan_restructure.py @@ -6,6 +6,7 @@ from frappe.utils import add_days, cint, flt, getdate from erpnext.controllers.accounts_controller import AccountsController + from lending.loan_management.doctype.loan.loan import ( update_all_linked_loan_customer_npa_status, update_watch_period_date_for_all_loans, @@ -733,4 +734,4 @@ def create_loan_repayment(loan, posting_date, repayment_type, waiver_amount, res repayment.amount_paid = waiver_amount repayment.loan_restructure = restructure_name repayment.save() - repayment.submit() \ No newline at end of file + repayment.submit() diff --git a/lending/loan_management/doctype/loan_restructure/loan_restructure_dashboard.py b/lending/loan_management/doctype/loan_restructure/loan_restructure_dashboard.py index 5949a3cc..cb9f4ae7 100644 --- a/lending/loan_management/doctype/loan_restructure/loan_restructure_dashboard.py +++ b/lending/loan_management/doctype/loan_restructure/loan_restructure_dashboard.py @@ -7,4 +7,4 @@ def get_data(): "transactions": [ {"items": ["Loan Repayment Schedule", "Loan Repayment"]}, ], - } \ No newline at end of file + } diff --git a/lending/loan_management/doctype/loan_restructure/test_loan_restructure.py b/lending/loan_management/doctype/loan_restructure/test_loan_restructure.py index 386fd36f..3a22f16c 100644 --- a/lending/loan_management/doctype/loan_restructure/test_loan_restructure.py +++ b/lending/loan_management/doctype/loan_restructure/test_loan_restructure.py @@ -6,4 +6,4 @@ class TestLoanRestructure(FrappeTestCase): - pass \ No newline at end of file + pass diff --git a/lending/loan_management/doctype/loan_restructure_limit_log/loan_restructure_limit_log.py b/lending/loan_management/doctype/loan_restructure_limit_log/loan_restructure_limit_log.py index 5fea4122..33381bd0 100644 --- a/lending/loan_management/doctype/loan_restructure_limit_log/loan_restructure_limit_log.py +++ b/lending/loan_management/doctype/loan_restructure_limit_log/loan_restructure_limit_log.py @@ -6,4 +6,4 @@ class LoanRestructureLimitLog(Document): - pass \ No newline at end of file + pass diff --git a/lending/loan_management/doctype/loan_restructure_limit_log/test_loan_restructure_limit_log.py b/lending/loan_management/doctype/loan_restructure_limit_log/test_loan_restructure_limit_log.py index ffc40b71..13c21f75 100644 --- a/lending/loan_management/doctype/loan_restructure_limit_log/test_loan_restructure_limit_log.py +++ b/lending/loan_management/doctype/loan_restructure_limit_log/test_loan_restructure_limit_log.py @@ -6,4 +6,4 @@ class TestLoanRestructureLimitLog(FrappeTestCase): - pass \ No newline at end of file + pass diff --git a/lending/loan_management/doctype/loan_security_deposit/loan_security_deposit.py b/lending/loan_management/doctype/loan_security_deposit/loan_security_deposit.py index e3dffe7f..625ce319 100644 --- a/lending/loan_management/doctype/loan_security_deposit/loan_security_deposit.py +++ b/lending/loan_management/doctype/loan_security_deposit/loan_security_deposit.py @@ -6,4 +6,4 @@ class LoanSecurityDeposit(Document): - pass \ No newline at end of file + pass diff --git a/lending/loan_management/doctype/loan_security_deposit/test_loan_security_deposit.py b/lending/loan_management/doctype/loan_security_deposit/test_loan_security_deposit.py index 909e7c99..b0fdefed 100644 --- a/lending/loan_management/doctype/loan_security_deposit/test_loan_security_deposit.py +++ b/lending/loan_management/doctype/loan_security_deposit/test_loan_security_deposit.py @@ -6,4 +6,4 @@ class TestLoanSecurityDeposit(FrappeTestCase): - pass \ No newline at end of file + pass diff --git a/lending/loan_management/doctype/process_asset_classification/process_asset_classification.py b/lending/loan_management/doctype/process_asset_classification/process_asset_classification.py index 60eb0b8d..ddeb8e52 100644 --- a/lending/loan_management/doctype/process_asset_classification/process_asset_classification.py +++ b/lending/loan_management/doctype/process_asset_classification/process_asset_classification.py @@ -37,4 +37,4 @@ def create_process_asset_classification( asset_classification.loan = loan asset_classification.previous_process = previous_process[0].name if previous_process else None asset_classification.payment_reference = payment_reference - asset_classification.submit() \ No newline at end of file + asset_classification.submit() diff --git a/lending/patches.txt b/lending/patches.txt index 026bbe7b..dde35f50 100644 --- a/lending/patches.txt +++ b/lending/patches.txt @@ -6,4 +6,4 @@ lending.patches.v15_0.generate_loan_repayment_schedule [post_model_sync] # Patches added in this section will be executed after doctypes are migrated lending.patches.v15_0.update_loan_types -lending.patches.v15_0.create_custom_fields \ No newline at end of file +lending.patches.v15_0.create_custom_fields #6 \ No newline at end of file diff --git a/lending/patches/v15_0/create_custom_fields.py b/lending/patches/v15_0/create_custom_fields.py index fbb4e059..0d5064af 100644 --- a/lending/patches/v15_0/create_custom_fields.py +++ b/lending/patches/v15_0/create_custom_fields.py @@ -2,4 +2,4 @@ def execute(): - after_install() \ No newline at end of file + after_install()