Disbursement Date fetched from JV - Employee Loan
This commit is contained in:
parent
f912317fae
commit
400c6f5aef
@ -394,7 +394,7 @@
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
@ -916,7 +916,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-03-13 15:55:11.143936",
|
||||
"modified": "2017-03-30 12:59:40.650035",
|
||||
"modified_by": "Administrator",
|
||||
"module": "HR",
|
||||
"name": "Employee Loan",
|
||||
@ -942,6 +942,27 @@
|
||||
"share": 1,
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
"email": 0,
|
||||
"export": 0,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 0,
|
||||
"read": 1,
|
||||
"report": 0,
|
||||
"role": "Employee",
|
||||
"set_user_permissions": 0,
|
||||
"share": 0,
|
||||
"submit": 0,
|
||||
"user_permission_doctypes": "[\"Employee\"]",
|
||||
"write": 0
|
||||
}
|
||||
],
|
||||
"quick_entry": 0,
|
||||
|
@ -94,17 +94,19 @@ class EmployeeLoan(AccountsController):
|
||||
|
||||
|
||||
def update_disbursement_status(doc):
|
||||
disbursed_amount = frappe.db.sql("""select ifnull(sum(debit_in_account_currency), 0) as disbursed_amount
|
||||
disbursement = frappe.db.sql("""select posting_date, ifnull(sum(debit_in_account_currency), 0) as disbursed_amount
|
||||
from `tabGL Entry` where against_voucher_type = 'Employee Loan' and against_voucher = %s""",
|
||||
(doc.name), as_dict=1)[0].disbursed_amount
|
||||
if disbursed_amount == doc.loan_amount:
|
||||
(doc.name), as_dict=1)[0]
|
||||
if disbursement.disbursed_amount == doc.loan_amount:
|
||||
frappe.db.set_value("Employee Loan", doc.name , "status", "Fully Disbursed")
|
||||
if disbursed_amount < doc.loan_amount and disbursed_amount != 0:
|
||||
if disbursement.disbursed_amount < doc.loan_amount and disbursement.disbursed_amount != 0:
|
||||
frappe.db.set_value("Employee Loan", doc.name , "status", "Partially Disbursed")
|
||||
if disbursed_amount == 0:
|
||||
if disbursement.disbursed_amount == 0:
|
||||
frappe.db.set_value("Employee Loan", doc.name , "status", "Sanctioned")
|
||||
if disbursed_amount > doc.loan_amount:
|
||||
if disbursement.disbursed_amount > doc.loan_amount:
|
||||
frappe.throw(_("Disbursed Amount cannot be greater than Loan Amount {0}").format(doc.loan_amount))
|
||||
if disbursement.disbursed_amount > 0:
|
||||
frappe.db.set_value("Employee Loan", doc.name , "disbursement_date", disbursement.posting_date)
|
||||
|
||||
def check_repayment_method(repayment_method, loan_amount, monthly_repayment_amount, repayment_periods):
|
||||
if repayment_method == "Repay Over Number of Periods" and not repayment_periods:
|
||||
|
Loading…
Reference in New Issue
Block a user