fix: selecting salary component (#24121)
This commit is contained in:
parent
0fc4bb02d1
commit
e64718b2ae
@ -12,14 +12,6 @@ frappe.ui.form.on('Additional Salary', {
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
if (!frm.doc.currency) return;
|
||||
frm.set_query("salary_component", function() {
|
||||
return {
|
||||
query: "erpnext.payroll.doctype.salary_structure.salary_structure.get_earning_deduction_components",
|
||||
filters: {currency: frm.doc.currency, company: frm.doc.company}
|
||||
};
|
||||
});
|
||||
},
|
||||
|
||||
employee: function(frm) {
|
||||
|
@ -11,11 +11,11 @@ frappe.ui.form.on('Employee Incentive', {
|
||||
};
|
||||
});
|
||||
|
||||
if (!frm.doc.currency) return;
|
||||
if (!frm.doc.company) return;
|
||||
frm.set_query("salary_component", function() {
|
||||
return {
|
||||
query: "erpnext.payroll.doctype.salary_structure.salary_structure.get_earning_deduction_components",
|
||||
filters: {type: "earning", currency: frm.doc.currency, company: frm.doc.company}
|
||||
filters: {type: "earning", company: frm.doc.company}
|
||||
};
|
||||
});
|
||||
|
||||
|
@ -55,17 +55,17 @@ frappe.ui.form.on('Salary Structure', {
|
||||
},
|
||||
|
||||
set_earning_deduction_component: function(frm) {
|
||||
if(!frm.doc.currency && !frm.doc.company) return;
|
||||
if(!frm.doc.company) return;
|
||||
frm.set_query("salary_component", "earnings", function() {
|
||||
return {
|
||||
query : "erpnext.payroll.doctype.salary_structure.salary_structure.get_earning_deduction_components",
|
||||
filters: {type: "earning", currency: frm.doc.currency, company: frm.doc.company}
|
||||
filters: {type: "earning", company: frm.doc.company}
|
||||
};
|
||||
});
|
||||
frm.set_query("salary_component", "deductions", function() {
|
||||
return {
|
||||
query : "erpnext.payroll.doctype.salary_structure.salary_structure.get_earning_deduction_components",
|
||||
filters: {type: "deduction", currency: frm.doc.currency, company: frm.doc.company}
|
||||
filters: {type: "deduction", company: frm.doc.company}
|
||||
};
|
||||
});
|
||||
},
|
||||
@ -74,7 +74,6 @@ frappe.ui.form.on('Salary Structure', {
|
||||
currency: function(frm) {
|
||||
calculate_totals(frm.doc);
|
||||
frm.trigger("set_dynamic_labels")
|
||||
frm.trigger('set_earning_deduction_component');
|
||||
frm.refresh()
|
||||
},
|
||||
|
||||
|
@ -210,7 +210,7 @@ def get_employees(salary_structure):
|
||||
@frappe.whitelist()
|
||||
@frappe.validate_and_sanitize_search_inputs
|
||||
def get_earning_deduction_components(doctype, txt, searchfield, start, page_len, filters):
|
||||
if len(filters) < 3:
|
||||
if len(filters) < 2:
|
||||
return {}
|
||||
|
||||
return frappe.db.sql("""
|
||||
|
Loading…
x
Reference in New Issue
Block a user