fix: Auto Loan Write Off
This commit is contained in:
parent
914ab7e4b0
commit
ec60063155
@ -202,7 +202,9 @@ def request_loan_closure(loan, posting_date=None):
|
||||
|
||||
# checking greater than 0 as there may be some minor precision error
|
||||
if pending_amount < write_off_limit:
|
||||
# update status as loan closure requested
|
||||
# Auto create loan write off and update status as loan closure requested
|
||||
write_off = make_loan_write_off(loan)
|
||||
write_off.submit()
|
||||
frappe.db.set_value('Loan', loan, 'status', 'Loan Closure Requested')
|
||||
else:
|
||||
frappe.throw(_("Cannot close loan as there is an outstanding of {0}").format(pending_amount))
|
||||
@ -336,13 +338,13 @@ def create_loan_security_unpledge(unpledge_map, loan, company, applicant_type, a
|
||||
return unpledge_request
|
||||
|
||||
def validate_employee_currency_with_company_currency(applicant, company):
|
||||
from erpnext.payroll.doctype.salary_structure_assignment.salary_structure_assignment import get_employee_currency
|
||||
if not applicant:
|
||||
frappe.throw(_("Please select Applicant"))
|
||||
if not company:
|
||||
frappe.throw(_("Please select Company"))
|
||||
employee_currency = get_employee_currency(applicant)
|
||||
company_currency = erpnext.get_company_currency(company)
|
||||
if employee_currency != company_currency:
|
||||
frappe.throw(_("Loan cannot be repayed from salary for Employee {0} because salary is processed in currency {1}")
|
||||
.format(applicant, employee_currency))
|
||||
from erpnext.payroll.doctype.salary_structure_assignment.salary_structure_assignment import get_employee_currency
|
||||
if not applicant:
|
||||
frappe.throw(_("Please select Applicant"))
|
||||
if not company:
|
||||
frappe.throw(_("Please select Company"))
|
||||
employee_currency = get_employee_currency(applicant)
|
||||
company_currency = erpnext.get_company_currency(company)
|
||||
if employee_currency != company_currency:
|
||||
frappe.throw(_("Loan cannot be repayed from salary for Employee {0} because salary is processed in currency {1}")
|
||||
.format(applicant, employee_currency))
|
||||
|
@ -144,17 +144,17 @@
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 1,
|
||||
"description": "Pending amount that will be automatically ignored on loan closure request ",
|
||||
"description": "Loan Write Off will be automatically created on loan closure request if pending amount is below this limit",
|
||||
"fieldname": "write_off_amount",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Write Off Amount ",
|
||||
"label": "Auto Write Off Amount ",
|
||||
"options": "Company:company:default_currency"
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"is_submittable": 1,
|
||||
"links": [],
|
||||
"modified": "2020-10-26 07:13:55.029811",
|
||||
"modified": "2021-01-17 06:51:26.082879",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Loan Management",
|
||||
"name": "Loan Type",
|
||||
|
Loading…
x
Reference in New Issue
Block a user