Skip to content

Commit

Permalink
feat: Loan Adjustment doctype
Browse files Browse the repository at this point in the history
  • Loading branch information
deepeshgarg007 committed Nov 29, 2023
1 parent 8d851d9 commit f1a6842
Show file tree
Hide file tree
Showing 9 changed files with 163 additions and 1 deletion.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt

// frappe.ui.form.on("Loan Adjustment", {
// refresh(frm) {

// },
// });
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"actions": [],
"allow_rename": 1,
"creation": "2023-11-29 12:22:43.406932",
"doctype": "DocType",
"engine": "InnoDB",
"field_order": [
"section_break_md4g",
"amended_from",
"posting_date",
"loan",
"is_foreclosure",
"adjustments"
],
"fields": [
{
"fieldname": "section_break_md4g",
"fieldtype": "Section Break"
},
{
"fieldname": "amended_from",
"fieldtype": "Link",
"label": "Amended From",
"no_copy": 1,
"options": "Loan Adjustment",
"print_hide": 1,
"read_only": 1,
"search_index": 1
},
{
"fieldname": "loan",
"fieldtype": "Link",
"label": "Loan",
"options": "Loan"
},
{
"default": "0",
"fieldname": "is_foreclosure",
"fieldtype": "Check",
"label": "Is Foreclosure"
},
{
"fieldname": "adjustments",
"fieldtype": "Table",
"label": "Adjustments",
"options": "Loan Adjustment Detail"
},
{
"fieldname": "posting_date",
"fieldtype": "Date",
"label": "Posting Date"
}
],
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
"modified": "2023-11-29 13:08:15.075604",
"modified_by": "Administrator",
"module": "Loan Management",
"name": "Loan Adjustment",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"share": 1,
"submit": 1,
"write": 1
}
],
"sort_field": "modified",
"sort_order": "DESC",
"states": []
}
15 changes: 15 additions & 0 deletions lending/loan_management/doctype/loan_adjustment/loan_adjustment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt

# import frappe
from frappe.model.document import Document

from lending.loan_management.doctype.loan_restructure.loan_restructure import create_loan_repayment


class LoanAdjustment(Document):
def on_submit(self):
for repayment in self.get("adjustments"):
create_loan_repayment(
self.loan, self.posting_date, repayment.loan_repayment_type, repayment.amount
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt

# import frappe
from frappe.tests.utils import FrappeTestCase


class TestLoanAdjustment(FrappeTestCase):
pass
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"actions": [],
"allow_rename": 1,
"creation": "2023-11-29 12:12:02.046525",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"loan_repayment_type",
"amount"
],
"fields": [
{
"fieldname": "loan_repayment_type",
"fieldtype": "Select",
"in_list_view": 1,
"label": "Loan Repayment Type",
"options": "Normal Repayment\nInterest Waiver\nPenalty Waiver\nCharges Waiver\nPrincipal Capitalization\nInterest Capitalization\nCharges Capitalization\nPenalty Capitalization\nPrincipal Adjustment\nInterest Adjustment\nInterest Carry Forward"
},
{
"fieldname": "amount",
"fieldtype": "Currency",
"in_list_view": 1,
"label": "Amount"
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2023-11-29 12:30:02.401145",
"modified_by": "Administrator",
"module": "Loan Management",
"name": "Loan Adjustment Detail",
"owner": "Administrator",
"permissions": [],
"sort_field": "modified",
"sort_order": "DESC",
"states": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt

# import frappe
from frappe.model.document import Document


class LoanAdjustmentDetail(Document):
pass
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,9 @@ def make_loan_adjustment_for_carry_forward(self):
)


def create_loan_repayment(loan, posting_date, repayment_type, waiver_amount, restructure_name):
def create_loan_repayment(
loan, posting_date, repayment_type, waiver_amount, restructure_name=None
):
repayment = frappe.new_doc("Loan Repayment")
repayment.offset_based_on_npa = 1
repayment.against_loan = loan
Expand Down

0 comments on commit f1a6842

Please sign in to comment.