[Fix] Wrong salary slips showing when click on view salary slips from payroll entry (#13152)
This commit is contained in:
parent
67cfa81de2
commit
0eb8bb2511
@ -5,7 +5,10 @@ var in_progress = false;
|
|||||||
|
|
||||||
frappe.ui.form.on('Payroll Entry', {
|
frappe.ui.form.on('Payroll Entry', {
|
||||||
onload: function (frm) {
|
onload: function (frm) {
|
||||||
|
if (!frm.doc.posting_date) {
|
||||||
frm.doc.posting_date = frappe.datetime.nowdate();
|
frm.doc.posting_date = frappe.datetime.nowdate();
|
||||||
|
}
|
||||||
|
|
||||||
frm.toggle_reqd(['payroll_frequency'], !frm.doc.salary_slip_based_on_timesheet);
|
frm.toggle_reqd(['payroll_frequency'], !frm.doc.salary_slip_based_on_timesheet);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@ -175,7 +175,7 @@ class PayrollEntry(Document):
|
|||||||
Get loan details from submitted salary slip based on selected criteria
|
Get loan details from submitted salary slip based on selected criteria
|
||||||
"""
|
"""
|
||||||
cond = self.get_filter_condition()
|
cond = self.get_filter_condition()
|
||||||
return frappe.db.sql(""" select eld.employee_loan_account,
|
return frappe.db.sql(""" select eld.employee_loan_account, eld.employee_loan,
|
||||||
eld.interest_income_account, eld.principal_amount, eld.interest_amount, eld.total_payment
|
eld.interest_income_account, eld.principal_amount, eld.interest_amount, eld.total_payment
|
||||||
from
|
from
|
||||||
`tabSalary Slip` t1, `tabSalary Slip Loan` eld
|
`tabSalary Slip` t1, `tabSalary Slip Loan` eld
|
||||||
@ -283,6 +283,11 @@ class PayrollEntry(Document):
|
|||||||
"account": data.employee_loan_account,
|
"account": data.employee_loan_account,
|
||||||
"credit_in_account_currency": data.principal_amount
|
"credit_in_account_currency": data.principal_amount
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if data.interest_amount and not data.interest_income_account:
|
||||||
|
frappe.throw(_("Select interest income account in employee loan {0}").format(data.employee_loan))
|
||||||
|
|
||||||
|
if data.interest_income_account and data.interest_amount:
|
||||||
accounts.append({
|
accounts.append({
|
||||||
"account": data.interest_income_account,
|
"account": data.interest_income_account,
|
||||||
"credit_in_account_currency": data.interest_amount,
|
"credit_in_account_currency": data.interest_amount,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user