Skip to content

Commit

Permalink
Merge pull request #88 from deepeshgarg007/charge_reversal
Browse files Browse the repository at this point in the history
feat: Loan disbursement charges
  • Loading branch information
deepeshgarg007 authored Oct 11, 2023
2 parents d4a01fb + 4ec5ae8 commit 8a580f7
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
"disbursed_amount",
"accounting_dimensions_section",
"cost_center",
"charges_section",
"loan_disbursement_charges",
"accounting_details",
"disbursement_account",
"column_break_16",
Expand Down Expand Up @@ -213,12 +215,23 @@
"label": "Loan Product",
"options": "Loan Product",
"read_only": 1
},
{
"fieldname": "charges_section",
"fieldtype": "Section Break",
"label": "Charges"
},
{
"fieldname": "loan_disbursement_charges",
"fieldtype": "Table",
"label": "Loan Disbursement Charges",
"options": "Loan Disbursement Charge"
}
],
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
"modified": "2023-10-02 22:14:24.804546",
"modified": "2023-10-10 19:19:44.826241",
"modified_by": "Administrator",
"module": "Loan Management",
"name": "Loan Disbursement",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,41 @@ def make_gl_entries(self, cancel=0, adv_adj=0):
)
)

for charge in self.get("loan_disbursement_charges"):
gle_map.append(
self.get_gl_dict(
{
"account": charge.account,
"against": self.disbursement_account,
"credit": charge.amount,
"credit_in_account_currency": charge.amount,
"against_voucher_type": "Loan",
"against_voucher": self.against_loan,
"remarks": _("Disbursement against loan:") + self.against_loan,
"cost_center": self.cost_center,
"party_type": self.applicant_type,
"party": self.applicant,
"posting_date": self.disbursement_date,
}
)
)

gle_map.append(
self.get_gl_dict(
{
"account": self.disbursement_account,
"against": self.loan_account,
"credit": -1 * charge.amount,
"credit_in_account_currency": -1 * charge.amount,
"against_voucher_type": "Loan",
"against_voucher": self.against_loan,
"remarks": _("Disbursement against loan:") + self.against_loan,
"cost_center": self.cost_center,
"posting_date": self.disbursement_date,
}
)
)

if gle_map:
make_gl_entries(gle_map, cancel=cancel, adv_adj=adv_adj)

Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"actions": [],
"allow_rename": 1,
"creation": "2023-10-10 19:06:41.545302",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"charge",
"amount",
"account"
],
"fields": [
{
"fieldname": "charge",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Charge",
"options": "Item"
},
{
"fieldname": "amount",
"fieldtype": "Currency",
"in_list_view": 1,
"label": "Amount"
},
{
"fieldname": "account",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Account",
"options": "Account"
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2023-10-10 19:47:07.918342",
"modified_by": "Administrator",
"module": "Loan Management",
"name": "Loan Disbursement Charge",
"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 LoanDisbursementCharge(Document):
pass
Original file line number Diff line number Diff line change
Expand Up @@ -1245,7 +1245,7 @@ def get_outstanding_invoices(loan, posting_date):
"Sales Invoice",
filters={
"loan": loan,
"outstanding_amount": (">", 0),
"outstanding_amount": ("!=", 0),
"docstatus": 1,
"due_date": ("<=", posting_date),
},
Expand Down

0 comments on commit 8a580f7

Please sign in to comment.