Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Process Loan interest change #137

Open
wants to merge 38 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
5986691
feat: Process Loan interest change
deepeshgarg007 Nov 24, 2023
2bec7c4
fix: queries
deepeshgarg007 Nov 24, 2023
cec72dd
feat: Loan document updates
deepeshgarg007 Nov 22, 2023
c39e72b
fix: Daily loan interest accruals
deepeshgarg007 Nov 29, 2023
09b1e22
feat: Daily interest accruals and loan demand generation
deepeshgarg007 Nov 29, 2023
ec4bb4c
feat: Loan booking updates
deepeshgarg007 Oct 13, 2023
d37fbbd
chore: Moratorium in loan schedule
deepeshgarg007 Oct 26, 2023
d68cc2a
feat: Moratorium in loan repayment schedule
deepeshgarg007 Oct 27, 2023
08b130f
feat: Line of credit loans
deepeshgarg007 Nov 3, 2023
d634eae
chore: shift repayment schedule generation from Loan to Loan Disburse…
deepeshgarg007 Nov 15, 2023
6620be4
feat: Loan Demand generation
deepeshgarg007 Nov 30, 2023
95bc3e2
Merge branch 'develop' of https://github.com/frappe/lending into proc…
deepeshgarg007 Nov 30, 2023
2cefebe
chore: add available and utilized limit amount in loan and logic
anandbaburajan Nov 30, 2023
b0284bd
chore: fix linting issues
anandbaburajan Nov 30, 2023
3d49337
chore: allow updating maximum_limit_amount
anandbaburajan Dec 1, 2023
d4056a6
feat: Loan Offset Allocation orders
deepeshgarg007 Dec 5, 2023
5da744a
Merge branch 'process_loan_interest_change_develop' of https://github…
deepeshgarg007 Dec 5, 2023
7cb462d
Merge branch 'develop' of https://github.com/frappe/lending into proc…
deepeshgarg007 Dec 11, 2023
81f5860
fix: Repayment schedule calculaitons
deepeshgarg007 Dec 7, 2023
40c1c3c
feat: broken period interest calculation
deepeshgarg007 Dec 11, 2023
d8f73b6
chore: tenure fixes
deepeshgarg007 Dec 11, 2023
84ba0c5
feat: Penalty accrual and calculation for loans
deepeshgarg007 Dec 15, 2023
1b7af5d
fix: Multi-tranch repayment schedules
deepeshgarg007 Dec 17, 2023
7503e41
fix: Error while submitting repayment schedule
deepeshgarg007 Dec 18, 2023
dfd3068
fix: Make loan security name non unique
deepeshgarg007 Dec 18, 2023
f1c91ab
fix: Multi tranch disbursement schedule generation
deepeshgarg007 Dec 20, 2023
e00f64b
fix: Sales Invoice generation via disbursement
deepeshgarg007 Dec 25, 2023
de34422
chore: Update test cases
deepeshgarg007 Jan 1, 2024
6b00732
fix: Against voucher links for Sales Invoice
deepeshgarg007 Jan 3, 2024
14b3a9f
feat: Process loan demand doctype
deepeshgarg007 Jan 8, 2024
3ca9ee3
fix: Multi tranch disbursement schedule
deepeshgarg007 Jan 9, 2024
e8cec38
fix: Demand for BPI row
deepeshgarg007 Jan 9, 2024
68c50ad
fix: Ledger and other fixes
deepeshgarg007 Jan 10, 2024
3a655bc
fix: LOC loan fixes
deepeshgarg007 Jan 11, 2024
b338fcf
fix: Single sales invoice for charges
deepeshgarg007 Jan 11, 2024
e2a7d0d
fix: Adhoc charges demand
deepeshgarg007 Jan 12, 2024
e481d07
fix: Demand generation
deepeshgarg007 Jan 12, 2024
69adfa9
feat: Installment Counts
deepeshgarg007 Jan 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 7 additions & 3 deletions lending/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,20 +116,24 @@
doc_events = {
"Company": {
"validate": "lending.overrides.company.validate_loan_tables",
}
},
"Sales Invoice": {
"on_submit": "lending.overrides.sales_invoice.generate_demand",
"on_cancel": "lending.overrides.sales_invoice.cancel_demand",
},
}

# Scheduled Tasks
# ---------------

scheduler_events = {
"daily_long": [
"lending.loan_management.doctype.process_loan_interest_accrual.process_loan_interest_accrual.process_loan_interest_accrual_for_loans",
"lending.loan_management.doctype.process_loan_security_shortfall.process_loan_security_shortfall.create_process_loan_security_shortfall",
"lending.loan_management.doctype.process_loan_interest_accrual.process_loan_interest_accrual.process_loan_interest_accrual_for_term_loans",
"lending.loan_management.doctype.process_loan_classification.process_loan_classification.create_process_loan_classification",
"lending.loan_management.doctype.process_loan_demand.process_loan_demand.process_daily_loan_demands",
],
"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",
],
}
Expand Down
27 changes: 18 additions & 9 deletions lending/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,16 @@
"options": "Loan",
"insert_after": "customer",
"print_hide": 1,
}
},
{
"fieldname": "loan_disbursement",
"label": "Loan Disbursement",
"fieldtype": "Link",
"options": "Loan Disbursement",
"insert_after": "Loan",
"read_only": 1,
"print_hide": 1,
},
],
"Company": [
{
Expand Down Expand Up @@ -74,29 +83,29 @@
{
"fieldname": "collection_offset_sequence_for_sub_standard_asset",
"label": "Collection Offset Sequence for Sub Standard Asset",
"fieldtype": "Select",
"options": "IP...IP...IP...CCC\nPPP...III...CCC",
"fieldtype": "Link",
"options": "Loan Demand Offset Order",
"insert_after": "days_past_due_threshold",
},
{
"fieldname": "collection_offset_sequence_for_standard_asset",
"label": "Collection Offset Sequence for Standard Asset",
"fieldtype": "Select",
"options": "IP...IP...IP...CCC\nPPP...III...CCC",
"fieldtype": "Link",
"options": "Loan Demand Offset Order",
"insert_after": "collection_offset_sequence_for_sub_standard_asset",
},
{
"fieldname": "collection_offset_sequence_for_written_off_asset",
"label": "Collection Offset Sequence for Written Off Asset",
"fieldtype": "Select",
"options": "IP...IP...IP...CCC\nPPP...III...CCC",
"fieldtype": "Link",
"options": "Loan Demand Offset Order",
"insert_after": "collection_offset_sequence_for_standard_asset",
},
{
"fieldname": "collection_offset_sequence_for_settlement_collection",
"label": "Collection Offset Sequence for Settlement Collection",
"fieldtype": "Select",
"options": "IP...IP...IP...CCC\nPPP...III...CCC",
"fieldtype": "Link",
"options": "Loan Demand Offset Order",
"insert_after": "collection_offset_sequence_for_written_off_asset",
},
{
Expand Down
10 changes: 7 additions & 3 deletions lending/loan_management/doctype/loan/loan.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ frappe.ui.form.on('Loan', {
},__('Create'));
}

if (["Sanctioned", "Partially Disbursed"].includes(frm.doc.status)) {
if (["Sanctioned", "Partially Disbursed", "Active"].includes(frm.doc.status)) {
frm.add_custom_button(__('Loan Disbursement'), function() {
frm.trigger("make_loan_disbursement");
},__('Create'));
Expand Down Expand Up @@ -128,9 +128,13 @@ frappe.ui.form.on('Loan', {
"company": frm.doc.company,
"applicant_type": frm.doc.applicant_type,
"applicant": frm.doc.applicant,
"pending_amount": frm.doc.loan_amount - frm.doc.disbursed_amount > 0 ?
"posting_date": frm.doc.posting_date,
"repayment_start_date": frm.doc.repayment_start_date,
"disbursement_amount": frm.doc.loan_amount - frm.doc.disbursed_amount > 0 ?
frm.doc.loan_amount - frm.doc.disbursed_amount : 0,
"as_dict": 1
"as_dict": 1,
"repayment_frequency": frm.doc.repayment_frequency,
"is_term_loan": frm.doc.is_term_loan
},
method: "lending.loan_management.doctype.loan.loan.make_loan_disbursement",
callback: function (r) {
Expand Down
132 changes: 116 additions & 16 deletions lending/loan_management/doctype/loan/loan.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"applicant",
"applicant_name",
"loan_application",
"branch",
"column_break_3",
"company",
"posting_date",
Expand All @@ -30,10 +29,21 @@
"column_break_11",
"maximum_loan_amount",
"repayment_method",
"repayment_frequency",
"repayment_periods",
"monthly_repayment_amount",
"repayment_start_date",
"moratorium_tenure",
"moratorium_type",
"treatment_of_interest",
"is_term_loan",
"loan_credit_limits_section",
"limit_applicable_start",
"maximum_limit_amount",
"available_limit_amount",
"column_break_foeo",
"limit_applicable_end",
"utilized_limit_amount",
"loan_classification_details_section",
"days_past_due",
"classification_code",
Expand All @@ -44,6 +54,8 @@
"tenure_post_restructure",
"accounting_dimensions_section",
"cost_center",
"loan_charges_section",
"loan_charges",
"account_info",
"disbursement_account",
"payment_account",
Expand Down Expand Up @@ -133,7 +145,7 @@
"in_standard_filter": 1,
"label": "Status",
"no_copy": 1,
"options": "Sanctioned\nPartially Disbursed\nDisbursed\nLoan Closure Requested\nClosed",
"options": "Sanctioned\nPartially Disbursed\nDisbursed\nActive\nLoan Closure Requested\nClosed",
"read_only": 1
},
{
Expand All @@ -142,6 +154,7 @@
"label": "Loan Details"
},
{
"depends_on": "eval:doc.repayment_schedule_type!=\"Line of Credit\"",
"fieldname": "loan_amount",
"fieldtype": "Currency",
"label": "Loan Amount",
Expand All @@ -154,7 +167,6 @@
"fieldname": "rate_of_interest",
"fieldtype": "Percent",
"label": "Rate of Interest (%) / Year",
"read_only": 1,
"reqd": 1
},
{
Expand All @@ -165,7 +177,7 @@
"no_copy": 1
},
{
"depends_on": "is_term_loan",
"depends_on": "eval: doc.is_term_loan && doc.repayment_schedule_type != \"Line of Credit\"",
"fieldname": "repayment_start_date",
"fieldtype": "Date",
"label": "Repayment Start Date"
Expand All @@ -175,25 +187,26 @@
"fieldtype": "Column Break"
},
{
"depends_on": "is_term_loan",
"depends_on": "eval: doc.is_term_loan && doc.repayment_schedule_type != \"Line of Credit\"",
"fieldname": "repayment_method",
"fieldtype": "Select",
"label": "Repayment Method",
"options": "\nRepay Fixed Amount per Period\nRepay Over Number of Periods"
},
{
"depends_on": "is_term_loan",
"depends_on": "eval: doc.is_term_loan && doc.repayment_schedule_type != \"Line of Credit\"",
"fieldname": "repayment_periods",
"fieldtype": "Int",
"label": "Repayment Period in Months"
"label": "Repayment Periods"
},
{
"depends_on": "is_term_loan",
"depends_on": "eval: doc.is_term_loan && doc.repayment_schedule_type != \"Line of Credit\"",
"fetch_from": "loan_application.repayment_amount",
"fetch_if_empty": 1,
"fieldname": "monthly_repayment_amount",
"fieldtype": "Currency",
"label": "Monthly Repayment Amount",
"no_copy": 1,
"options": "Company:company:default_currency"
},
{
Expand Down Expand Up @@ -392,20 +405,23 @@
"fieldname": "is_npa",
"fieldtype": "Check",
"label": "Is NPA",
"no_copy": 1,
"read_only": 1
},
{
"depends_on": "is_term_loan",
"fetch_from": "loan_product.repayment_schedule_type",
"fieldname": "repayment_schedule_type",
"fieldtype": "Data",
"hidden": 1,
"label": "Repayment Schedule Type",
"read_only": 1
},
{
"fieldname": "days_past_due",
"fieldtype": "Int",
"label": "Days Past Due",
"no_copy": 1,
"read_only": 1
},
{
Expand All @@ -415,18 +431,14 @@
"description": "Manually marked as NPA",
"fieldname": "manual_npa",
"fieldtype": "Check",
"label": "Manual NPA"
},
{
"fieldname": "branch",
"fieldtype": "Link",
"label": "Branch",
"options": "Branch"
"label": "Manual NPA",
"no_copy": 1
},
{
"fieldname": "loan_restructure_count",
"fieldtype": "Int",
"label": "Loan Restructure Count",
"no_copy": 1,
"read_only": 1
},
{
Expand All @@ -437,12 +449,14 @@
"fieldname": "watch_period_end_date",
"fieldtype": "Date",
"label": "Watch Period End Date",
"no_copy": 1,
"read_only": 1
},
{
"fieldname": "tenure_post_restructure",
"fieldtype": "Int",
"label": "Tenure Post Restructure",
"no_copy": 1,
"read_only": 1
},
{
Expand All @@ -466,18 +480,104 @@
"fieldtype": "Section Break",
"label": "Loan Classification Details"
},
{
"depends_on": "eval: doc.is_term_loan && doc.repayment_schedule_type != \"Line of Credit\"",
"fieldname": "repayment_frequency",
"fieldtype": "Select",
"label": "Repayment Frequency",
"options": "Monthly\nDaily\nWeekly\nQuarterly\nOne Time"
},
{
"fieldname": "loan_charges",
"fieldtype": "Table",
"label": "Loan Charges",
"options": "Loan Disbursement Charge"
},
{
"fieldname": "loan_charges_section",
"fieldtype": "Section Break",
"label": "Loan Charges"
},
{
"depends_on": "moratorium_tenure",
"fieldname": "treatment_of_interest",
"fieldtype": "Select",
"label": "Treatment of Interest",
"mandatory_depends_on": "moratorium_tenure",
"options": "Capitalize\nAdd to first repayment"
},
{
"depends_on": "eval: doc.is_term_loan && doc.repayment_schedule_type != \"Line of Credit\"",
"fieldname": "moratorium_tenure",
"fieldtype": "Int",
"label": "Moratorium Tenure"
},
{
"depends_on": "eval:doc.repayment_schedule_type == \"Line of Credit\"",
"fieldname": "loan_credit_limits_section",
"fieldtype": "Section Break",
"label": "Loan Credit Limits"
},
{
"fieldname": "limit_applicable_start",
"fieldtype": "Date",
"label": "Limit Applicable Start",
"mandatory_depends_on": "eval: doc.repayment_schedule_type == \"Line of Credit\"",
"no_copy": 1
},
{
"fieldname": "column_break_foeo",
"fieldtype": "Column Break"
},
{
"fieldname": "limit_applicable_end",
"fieldtype": "Date",
"label": "Limit Applicable End",
"mandatory_depends_on": "eval: doc.repayment_schedule_type == \"Line of Credit\"",
"no_copy": 1
},
{
"allow_on_submit": 1,
"fieldname": "maximum_limit_amount",
"fieldtype": "Currency",
"label": "Maximum Limit Amount",
"mandatory_depends_on": "eval: doc.repayment_schedule_type == \"Line of Credit\"",
"no_copy": 1
},
{
"fetch_from": "loan_product.loan_category",
"fieldname": "loan_category",
"fieldtype": "Link",
"label": "Loan Category",
"options": "Loan Category"
},
{
"allow_on_submit": 1,
"fieldname": "available_limit_amount",
"fieldtype": "Currency",
"label": "Available Limit Amount",
"no_copy": 1,
"read_only": 1
},
{
"fieldname": "utilized_limit_amount",
"fieldtype": "Currency",
"label": "Utilized Limit Amount",
"no_copy": 1,
"read_only": 1
},
{
"depends_on": "eval: doc.is_term_loan && doc.repayment_schedule_type != \"Line of Credit\"",
"fieldname": "moratorium_type",
"fieldtype": "Select",
"label": "Moratorium Type",
"options": "EMI\nInterest"
}
],
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
"modified": "2023-11-29 19:34:09.691251",
"modified": "2024-01-11 16:49:57.074283",
"modified_by": "Administrator",
"module": "Loan Management",
"name": "Loan",
Expand Down