Employee Benefit Application - whitlist method get_max_benefits
This commit is contained in:
parent
3e64297a3d
commit
3abae9c1ba
@ -15,8 +15,11 @@ frappe.ui.form.on('Employee Benefit Application', {
|
|||||||
},
|
},
|
||||||
employee: function(frm) {
|
employee: function(frm) {
|
||||||
frappe.call({
|
frappe.call({
|
||||||
doc: frm.doc,
|
method: "erpnext.hr.doctype.employee_benefit_application.employee_benefit_application.get_max_benefits",
|
||||||
method: "get_max_benefits",
|
args:{
|
||||||
|
employee: frm.doc.employee,
|
||||||
|
on_date: frm.doc.date
|
||||||
|
},
|
||||||
callback: function (data) {
|
callback: function (data) {
|
||||||
if(!data.exc){
|
if(!data.exc){
|
||||||
if(data.message){
|
if(data.message){
|
||||||
|
|||||||
@ -48,16 +48,17 @@ class EmployeeBenefitApplication(Document):
|
|||||||
if application:
|
if application:
|
||||||
frappe.throw(_("Employee {0} already submited an apllication {1} for the payroll period {2}").format(self.employee, application, self.payroll_period))
|
frappe.throw(_("Employee {0} already submited an apllication {1} for the payroll period {2}").format(self.employee, application, self.payroll_period))
|
||||||
|
|
||||||
def get_max_benefits(self):
|
@frappe.whitelist()
|
||||||
sal_struct = get_assigned_salary_sturecture(self.employee, self.date)
|
def get_max_benefits(employee, on_date):
|
||||||
|
sal_struct = get_assigned_salary_sturecture(employee, on_date)
|
||||||
if sal_struct:
|
if sal_struct:
|
||||||
max_benefits = frappe.db.get_value("Salary Structure", sal_struct[0][0], "max_benefits")
|
max_benefits = frappe.db.get_value("Salary Structure", sal_struct[0][0], "max_benefits")
|
||||||
if max_benefits > 0:
|
if max_benefits > 0:
|
||||||
return max_benefits
|
return max_benefits
|
||||||
else:
|
else:
|
||||||
frappe.throw(_("Employee {0} has no max benefits in salary structure {1}").format(self.employee, sal_struct[0][0]))
|
frappe.throw(_("Employee {0} has no max benefits in salary structure {1}").format(employee, sal_struct[0][0]))
|
||||||
else:
|
else:
|
||||||
frappe.throw(_("Employee {0} has no salary structure assigned").format(self.employee))
|
frappe.throw(_("Employee {0} has no salary structure assigned").format(employee))
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user