Merge pull request #8213 from KanchanChauhan/update-disbursment-date
Disbursement Date fetched from JV - Employee Loan
This commit is contained in:
commit
f90a3295c4
@ -394,7 +394,7 @@
|
|||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"remember_last_selected_value": 0,
|
"remember_last_selected_value": 0,
|
||||||
"report_hide": 0,
|
"report_hide": 0,
|
||||||
"reqd": 1,
|
"reqd": 0,
|
||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
@ -916,7 +916,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2017-03-30 12:58:58.566812",
|
"modified": "2017-03-30 12:59:40.650035",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "HR",
|
"module": "HR",
|
||||||
"name": "Employee Loan",
|
"name": "Employee Loan",
|
||||||
|
@ -94,17 +94,19 @@ class EmployeeLoan(AccountsController):
|
|||||||
|
|
||||||
|
|
||||||
def update_disbursement_status(doc):
|
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""",
|
from `tabGL Entry` where against_voucher_type = 'Employee Loan' and against_voucher = %s""",
|
||||||
(doc.name), as_dict=1)[0].disbursed_amount
|
(doc.name), as_dict=1)[0]
|
||||||
if disbursed_amount == doc.loan_amount:
|
if disbursement.disbursed_amount == doc.loan_amount:
|
||||||
frappe.db.set_value("Employee Loan", doc.name , "status", "Fully Disbursed")
|
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")
|
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")
|
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))
|
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):
|
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:
|
if repayment_method == "Repay Over Number of Periods" and not repayment_periods:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user