Merge pull request #8213 from KanchanChauhan/update-disbursment-date

Disbursement Date fetched from JV - Employee Loan
This commit is contained in:
Nabin Hait 2017-03-30 13:06:40 +05:30 committed by GitHub
commit f90a3295c4
2 changed files with 10 additions and 8 deletions

View File

@ -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-30 12:58:58.566812",
"modified": "2017-03-30 12:59:40.650035",
"modified_by": "Administrator",
"module": "HR",
"name": "Employee Loan",

View File

@ -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: