[Fix] lwp issue fixed for salary slip without salary structure
This commit is contained in:
parent
d97ec828b5
commit
4a888b4c91
@ -43,6 +43,16 @@ frappe.ui.form.on("Process Payroll", {
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
account: function(frm) {
|
||||
var account_types = ["Bank", "Cash"];
|
||||
return {
|
||||
filters: {
|
||||
"account_type": ["in", account_types],
|
||||
"is_group": 0,
|
||||
"company": frm.doc.company
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -114,22 +114,15 @@ var calculate_all = function(doc, dt, dn) {
|
||||
}
|
||||
|
||||
cur_frm.cscript.amount = function(doc,dt,dn){
|
||||
calculate_earning_total(doc, dt, dn);
|
||||
calculate_net_pay(doc, dt, dn);
|
||||
var child = locals[dt][dn];
|
||||
if(!doc.salary_structure){
|
||||
frappe.model.set_value(dt,dn, "default_amount", child.amount)
|
||||
}
|
||||
calculate_all(doc, dt, dn);
|
||||
}
|
||||
|
||||
cur_frm.cscript.depends_on_lwp = function(doc,dt,dn){
|
||||
calculate_earning_total(doc, dt, dn, true);
|
||||
calculate_net_pay(doc, dt, dn);
|
||||
}
|
||||
// Trigger on earning modified amount and depends on lwp
|
||||
// ------------------------------------------------------------------------
|
||||
cur_frm.cscript.amount = function(doc,dt,dn){
|
||||
calculate_ded_total(doc, dt, dn);
|
||||
calculate_net_pay(doc, dt, dn);
|
||||
}
|
||||
|
||||
cur_frm.cscript.depends_on_lwp = function(doc, dt, dn) {
|
||||
calculate_ded_total(doc, dt, dn, true);
|
||||
calculate_net_pay(doc, dt, dn);
|
||||
};
|
||||
|
@ -10,7 +10,6 @@ from frappe.model.naming import make_autoname
|
||||
from frappe import msgprint, _
|
||||
from erpnext.accounts.utils import get_fiscal_year
|
||||
from erpnext.setup.utils import get_company_currency
|
||||
from erpnext.hr.utils import set_employee_name
|
||||
from erpnext.hr.doctype.process_payroll.process_payroll import get_month_details
|
||||
from erpnext.hr.doctype.employee.employee import get_holiday_list_for_employee
|
||||
from erpnext.utilities.transaction_base import TransactionBase
|
||||
@ -84,7 +83,7 @@ class SalarySlip(TransactionBase):
|
||||
if d.amount_based_on_formula:
|
||||
if d.formula:
|
||||
amount = eval(d.formula, None, data)
|
||||
if amount:
|
||||
if amount:
|
||||
data[d.abbr] = amount
|
||||
return amount
|
||||
|
||||
@ -316,7 +315,7 @@ class SalarySlip(TransactionBase):
|
||||
def sum_components(self, component_type, total_field):
|
||||
for d in self.get(component_type):
|
||||
if cint(d.depends_on_lwp) == 1 and not self.salary_slip_based_on_timesheet:
|
||||
d.amount = rounded((flt(d.amount) * flt(self.payment_days)
|
||||
d.amount = rounded((flt(d.default_amount) * flt(self.payment_days)
|
||||
/ cint(self.total_days_in_month)), self.precision("amount", component_type))
|
||||
elif not self.payment_days and not self.salary_slip_based_on_timesheet:
|
||||
d.amount = 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user