Skip to content

Commit

Permalink
[Fix] Wrong salary slips showing when click on view salary slips from…
Browse files Browse the repository at this point in the history
… payroll entry (frappe#13152)
  • Loading branch information
rohitwaghchaure authored and nabinhait committed Mar 5, 2018
1 parent 67cfa81 commit 0eb8bb2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 4 additions & 1 deletion erpnext/hr/doctype/payroll_entry/payroll_entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ var in_progress = false;

frappe.ui.form.on('Payroll Entry', {
onload: function (frm) {
frm.doc.posting_date = frappe.datetime.nowdate();
if (!frm.doc.posting_date) {
frm.doc.posting_date = frappe.datetime.nowdate();
}

frm.toggle_reqd(['payroll_frequency'], !frm.doc.salary_slip_based_on_timesheet);
},

Expand Down
9 changes: 7 additions & 2 deletions erpnext/hr/doctype/payroll_entry/payroll_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def get_loan_details(self):
Get loan details from submitted salary slip based on selected criteria
"""
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
from
`tabSalary Slip` t1, `tabSalary Slip Loan` eld
Expand Down Expand Up @@ -283,7 +283,12 @@ def make_accural_jv_entry(self):
"account": data.employee_loan_account,
"credit_in_account_currency": data.principal_amount
})
accounts.append({

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({
"account": data.interest_income_account,
"credit_in_account_currency": data.interest_amount,
"cost_center": self.cost_center,
Expand Down

0 comments on commit 0eb8bb2

Please sign in to comment.