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

chore: rename process_asset_classification #6

Merged
merged 2 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lending/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
"daily_long": [
"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_asset_classification.process_asset_classification.create_process_asset_classification",
"lending.loan_management.doctype.process_loan_asset_classification.process_loan_asset_classification.create_process_loan_asset_classification",
],
"monthly_long": [
"lending.loan_management.doctype.process_loan_interest_accrual.process_loan_interest_accrual.process_loan_interest_accrual_for_demand_loans",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,78 +1,78 @@
{
"actions": [],
"creation": "2023-04-26 17:07:40.828226",
"default_view": "List",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"loan",
"posting_date",
"days_past_due",
"process_asset_classification"
],
"fields": [
{
"fieldname": "loan",
"fieldtype": "Link",
"label": "Loan",
"options": "Loan",
"read_only": 1
},
{
"fieldname": "posting_date",
"fieldtype": "Date",
"label": "Posting Date",
"read_only": 1
},
{
"fieldname": "days_past_due",
"fieldtype": "Int",
"label": "Days Past Due",
"read_only": 1
},
{
"fieldname": "process_asset_classification",
"fieldtype": "Link",
"label": "Process Asset Classification",
"options": "Process Asset Classification",
"read_only": 1
}
],
"in_create": 1,
"links": [],
"modified": "2023-05-18 13:54:43.543481",
"modified_by": "Administrator",
"module": "Loan Management",
"name": "Days Past Due Log",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"share": 1,
"write": 1
},
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "Loan Manager",
"share": 1,
"write": 1
}
],
"sort_field": "modified",
"sort_order": "DESC",
"states": []
"actions": [],
"creation": "2023-04-26 17:07:40.828226",
"default_view": "List",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"loan",
"posting_date",
"days_past_due",
"process_loan_asset_classification"
],
"fields": [
{
"fieldname": "loan",
"fieldtype": "Link",
"label": "Loan",
"options": "Loan",
"read_only": 1
},
{
"fieldname": "posting_date",
"fieldtype": "Date",
"label": "Posting Date",
"read_only": 1
},
{
"fieldname": "days_past_due",
"fieldtype": "Int",
"label": "Days Past Due",
"read_only": 1
},
{
"fieldname": "process_loan_asset_classification",
"fieldtype": "Link",
"label": "Process Loan Asset Classification",
"options": "Process Loan Asset Classification",
"read_only": 1
}
],
"in_create": 1,
"links": [],
"modified": "2023-08-25 15:37:21.206963",
"modified_by": "Administrator",
"module": "Loan Management",
"name": "Days Past Due Log",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"share": 1,
"write": 1
},
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "Loan Manager",
"share": 1,
"write": 1
}
],
"sort_field": "modified",
"sort_order": "DESC",
"states": []
}
16 changes: 9 additions & 7 deletions lending/loan_management/doctype/loan/loan.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ def make_refund_jv(loan, amount=0, reference_number=None, reference_date=None, s

@frappe.whitelist()
def update_days_past_due_in_loans(
posting_date=None, loan_type=None, loan_name=None, process_asset_classification=None
posting_date=None, loan_type=None, loan_name=None, process_loan_asset_classification=None
):
"""Update days past due in loans"""
posting_date = posting_date or getdate()
Expand Down Expand Up @@ -579,7 +579,7 @@ def update_days_past_due_in_loans(
posting_date or getdate(),
)

create_dpd_record(loan.loan, posting_date, days_past_due, process_asset_classification)
create_dpd_record(loan.loan, posting_date, days_past_due, process_loan_asset_classification)
checked_loans.append(loan.loan)

open_loans_with_no_overdue = []
Expand All @@ -601,17 +601,19 @@ def update_days_past_due_in_loans(
d.name, d.company, d.applicant_type, d.applicant, 0, 0, posting_date or getdate()
)

create_dpd_record(d.name, posting_date, 0, process_asset_classification)
create_dpd_record(d.name, posting_date, 0, process_loan_asset_classification)


def restore_pervious_dpd_state(applicant_type, applicant, repayment_reference):
pac = frappe.db.get_value(
"Process Asset Classification", {"payment_reference": repayment_reference}, "previous_process"
"Process Loan Asset Classification",
{"payment_reference": repayment_reference},
"previous_process",
)
for d in frappe.db.get_all(
"Days Past Due Log",
filters={
"process_asset_classification": pac,
"process_loan_asset_classification": pac,
"applicant_type": applicant_type,
"applicant": applicant,
},
Expand All @@ -620,14 +622,14 @@ def restore_pervious_dpd_state(applicant_type, applicant, repayment_reference):
frappe.db.set_value("Loan", d.loan, "days_past_due", d.days_past_due)


def create_dpd_record(loan, posting_date, days_past_due, process_asset_classification=None):
def create_dpd_record(loan, posting_date, days_past_due, process_loan_asset_classification=None):
frappe.get_doc(
{
"doctype": "Days Past Due Log",
"loan": loan,
"posting_date": posting_date,
"days_past_due": days_past_due,
"process_asset_classification": process_asset_classification,
"process_loan_asset_classification": process_loan_asset_classification,
}
).insert(ignore_permissions=True)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
from lending.loan_management.doctype.loan_interest_accrual.loan_interest_accrual import (
days_in_year,
)
from lending.loan_management.doctype.process_asset_classification.process_asset_classification import (
create_process_asset_classification,
from lending.loan_management.doctype.process_loan_asset_classification.process_loan_asset_classification import (
create_process_loan_asset_classification,
)
from lending.loan_management.doctype.process_loan_interest_accrual.process_loan_interest_accrual import (
process_loan_interest_accrual_for_demand_loans,
Expand Down Expand Up @@ -122,7 +122,7 @@ def test_dpd_calculation(self):

make_loan_disbursement_entry(loan.name, loan.loan_amount, disbursement_date="2023-02-01")
process_loan_interest_accrual_for_term_loans(posting_date="2023-02-01")
create_process_asset_classification(
create_process_loan_asset_classification(
posting_date="2023-02-02", loan_type=loan.loan_type, loan=loan.name
)

Expand All @@ -137,7 +137,7 @@ def test_dpd_calculation(self):
self.assertEqual(loan_details.asset_classification_code, "SMA-0")
self.assertEqual(loan_details.asset_classification_name, "Special Mention Account - 0")

create_process_asset_classification(
create_process_loan_asset_classification(
posting_date="2023-04-05", loan_type=loan.loan_type, loan=loan.name
)
loan_details = frappe.db.get_value(
Expand All @@ -151,7 +151,7 @@ def test_dpd_calculation(self):
self.assertEqual(loan_details.asset_classification_code, "SMA-2")
self.assertEqual(loan_details.asset_classification_name, "Special Mention Account - 2")

create_process_asset_classification(
create_process_loan_asset_classification(
posting_date="2023-07-05", loan_type=loan.loan_type, loan=loan.name
)
loan_details = frappe.db.get_value(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ lending.common.setup_filters("Loan Repayment");

frappe.ui.form.on('Loan Repayment', {
setup(frm) {
frm.ignore_doctypes_on_cancel_all = ["Process Asset Classification"];
frm.ignore_doctypes_on_cancel_all = ["Process Loan Asset Classification"];
},
onload: function(frm) {
frm.set_query('against_loan', function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
from lending.loan_management.doctype.loan_security_shortfall.loan_security_shortfall import (
update_shortfall_status,
)
from lending.loan_management.doctype.process_asset_classification.process_asset_classification import (
create_process_asset_classification,
from lending.loan_management.doctype.process_loan_asset_classification.process_loan_asset_classification import (
create_process_loan_asset_classification,
)
from lending.loan_management.doctype.process_loan_interest_accrual.process_loan_interest_accrual import (
process_loan_interest_accrual_for_demand_loans,
Expand All @@ -41,7 +41,7 @@ def before_submit(self):
def on_submit(self):
if self.repayment_type == "Normal Repayment":

create_process_asset_classification(
create_process_loan_asset_classification(
posting_date=self.posting_date,
loan_type=self.loan_type,
loan=self.against_loan,
Expand Down Expand Up @@ -71,7 +71,7 @@ def on_cancel(self):
self.ignore_linked_doctypes = [
"GL Entry",
"Payment Ledger Entry",
"Process Asset Classification",
"Process Loan Asset Classification",
]
self.make_gl_entries(cancel=1)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
frappe.ui.form.on("Loan Restructure", {
refresh: function (frm) {
frm.trigger("toggle_fields");
frm.ignore_doctypes_on_cancel_all = ['Loan Balance Adjustment', 'Loan Repayment', 'Loan Repayment Schedule', 'Process Asset Classification'];
frm.ignore_doctypes_on_cancel_all = ['Loan Balance Adjustment', 'Loan Repayment', 'Loan Repayment Schedule', 'Process Loan Asset Classification'];
},

new_repayment_method: function (frm) {
Expand Down
Loading
Loading