diff --git a/lending/loan_management/doctype/loan_adjustment/__init__.py b/lending/loan_management/doctype/loan_adjustment/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/lending/loan_management/doctype/loan_adjustment/loan_adjustment.js b/lending/loan_management/doctype/loan_adjustment/loan_adjustment.js new file mode 100644 index 00000000..d42a578e --- /dev/null +++ b/lending/loan_management/doctype/loan_adjustment/loan_adjustment.js @@ -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) { + +// }, +// }); diff --git a/lending/loan_management/doctype/loan_adjustment/loan_adjustment.json b/lending/loan_management/doctype/loan_adjustment/loan_adjustment.json new file mode 100644 index 00000000..202cf79d --- /dev/null +++ b/lending/loan_management/doctype/loan_adjustment/loan_adjustment.json @@ -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": [] +} \ No newline at end of file diff --git a/lending/loan_management/doctype/loan_adjustment/loan_adjustment.py b/lending/loan_management/doctype/loan_adjustment/loan_adjustment.py new file mode 100644 index 00000000..023ccf3b --- /dev/null +++ b/lending/loan_management/doctype/loan_adjustment/loan_adjustment.py @@ -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 + ) diff --git a/lending/loan_management/doctype/loan_adjustment/test_loan_adjustment.py b/lending/loan_management/doctype/loan_adjustment/test_loan_adjustment.py new file mode 100644 index 00000000..dbe92e27 --- /dev/null +++ b/lending/loan_management/doctype/loan_adjustment/test_loan_adjustment.py @@ -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 diff --git a/lending/loan_management/doctype/loan_adjustment_detail/__init__.py b/lending/loan_management/doctype/loan_adjustment_detail/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/lending/loan_management/doctype/loan_adjustment_detail/loan_adjustment_detail.json b/lending/loan_management/doctype/loan_adjustment_detail/loan_adjustment_detail.json new file mode 100644 index 00000000..3b44d899 --- /dev/null +++ b/lending/loan_management/doctype/loan_adjustment_detail/loan_adjustment_detail.json @@ -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": [] +} \ No newline at end of file diff --git a/lending/loan_management/doctype/loan_adjustment_detail/loan_adjustment_detail.py b/lending/loan_management/doctype/loan_adjustment_detail/loan_adjustment_detail.py new file mode 100644 index 00000000..7486dea4 --- /dev/null +++ b/lending/loan_management/doctype/loan_adjustment_detail/loan_adjustment_detail.py @@ -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 diff --git a/lending/loan_management/doctype/loan_restructure/loan_restructure.py b/lending/loan_management/doctype/loan_restructure/loan_restructure.py index c786ee26..a6035d03 100644 --- a/lending/loan_management/doctype/loan_restructure/loan_restructure.py +++ b/lending/loan_management/doctype/loan_restructure/loan_restructure.py @@ -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