Skip to content

Commit

Permalink
fix: Loan Reco updates
Browse files Browse the repository at this point in the history
  • Loading branch information
deepeshgarg007 committed Feb 23, 2024
1 parent 21a19b6 commit e38a571
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 22 deletions.
14 changes: 8 additions & 6 deletions lending/loan_management/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,11 @@ def get_ld_matching_query(bank_account, exact_match, transaction):
(ref_rank + party_rank + 1).as_("rank"),
ConstantColumn("Loan Disbursement").as_("doctype"),
loan_disbursement.name,
loan_disbursement.disbursed_amount,
loan_disbursement.reference_number,
(loan_disbursement.disbursed_amount).as_("paid_amount"),
(loan_disbursement.reference_number).as_("reference_no"),
loan_disbursement.reference_date,
loan_disbursement.applicant_type,
(loan_disbursement.applicant_type).as_("party_type"),
(loan_disbursement.applicant).as_("party"),
loan_disbursement.disbursement_date,
)
.where(loan_disbursement.docstatus == 1)
Expand Down Expand Up @@ -158,10 +159,11 @@ def get_lr_matching_query(bank_account, exact_match, transaction):
(ref_rank + party_rank + 1).as_("rank"),
ConstantColumn("Loan Repayment").as_("doctype"),
loan_repayment.name,
loan_repayment.amount_paid,
loan_repayment.reference_number,
(loan_repayment.amount_paid).as_("paid_amount"),
(loan_repayment.reference_number).as_("reference_no"),
loan_repayment.reference_date,
loan_repayment.applicant_type,
(loan_repayment.applicant_type).as_("party_type"),
(loan_repayment.applicant).as_("party"),
loan_repayment.posting_date,
)
.where(loan_repayment.docstatus == 1)
Expand Down
16 changes: 8 additions & 8 deletions lending/patches/v15_0/generate_loan_repayment_schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ def execute():
return

for loan in frappe.get_all("Loan", filters={"is_term_loan": 1, "docstatus": ["!=", 2]}):
loan = frappe.get_cached_doc("Loan", loan.name)
loan_doc = frappe.get_cached_doc("Loan", loan.name)
loan_repayment_schedule = frappe.new_doc("Loan Repayment Schedule")
loan_repayment_schedule.flags.ignore_validate = True
loan_repayment_schedule.loan = loan.name
loan_repayment_schedule.loan_product = loan.loan_type
loan_repayment_schedule.loan_amount = loan.loan_amount
loan_repayment_schedule.monthly_repayment_amount = loan.monthly_repayment_amount
loan_repayment_schedule.posting_date = loan.posting_date
loan_repayment_schedule.status = get_status(loan.status)
loan_repayment_schedule.loan = loan_doc.name
loan_repayment_schedule.loan_product = frappe.db.get_value("Loan", loan_doc.name, "loan_type")
loan_repayment_schedule.loan_amount = loan_doc.loan_amount
loan_repayment_schedule.monthly_repayment_amount = loan_doc.monthly_repayment_amount
loan_repayment_schedule.posting_date = loan_doc.posting_date
loan_repayment_schedule.status = get_status(loan_doc.status)

repayment_schedules = frappe.db.get_all(
"Repayment Schedule", {"parent": loan.name}, "*", order_by="idx"
"Repayment Schedule", {"parent": loan_doc.name}, "*", order_by="idx"
)

for rs in repayment_schedules:
Expand Down
7 changes: 0 additions & 7 deletions lending/public/dist/js/lending.bundle.2O3MYYF2.js.map

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions lending/public/dist/js/lending.bundle.H2KPP2TL.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e38a571

Please sign in to comment.