Merge branch 'develop' into tcs_calculation

This commit is contained in:
Saqib 2021-01-27 19:47:19 +05:30 committed by GitHub
commit 31eb740aef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 32 deletions

View File

@ -53,8 +53,7 @@ frappe.ui.form.on('Additional Salary', {
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", company: frm.doc.company}
filters: {type: ["in", ["earning", "deduction"]], company: frm.doc.company}
};
});
},

View File

@ -10,15 +10,7 @@ frappe.ui.form.on('Employee Incentive', {
}
};
});
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", company: frm.doc.company}
};
});
frm.trigger('set_earning_component');
},
employee: function(frm) {
@ -45,11 +37,21 @@ frappe.ui.form.on('Employee Incentive', {
callback: function(data) {
if (data.message) {
frm.set_value("company", data.message.company);
frm.trigger('set_earning_component');
}
}
});
},
set_earning_component: function(frm) {
if (!frm.doc.company) return;
frm.set_query("salary_component", function() {
return {
filters: {type: "earning", company: frm.doc.company}
};
});
},
get_employee_currency: function(frm) {
frappe.call({
method: "erpnext.payroll.doctype.salary_structure_assignment.salary_structure_assignment.get_employee_currency",

View File

@ -58,13 +58,11 @@ frappe.ui.form.on('Salary Structure', {
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", 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", company: frm.doc.company}
};
});

View File

@ -207,22 +207,3 @@ def get_employees(salary_structure):
return list(set([d.employee for d in employees]))
@frappe.whitelist()
@frappe.validate_and_sanitize_search_inputs
def get_earning_deduction_components(doctype, txt, searchfield, start, page_len, filters):
if len(filters) < 2:
return {}
return frappe.db.sql("""
select t1.salary_component
from `tabSalary Component` t1, `tabSalary Component Account` t2
where (t1.name = t2.parent
and t1.type = %(type)s
and t2.company = %(company)s)
or (t1.type = %(type)s
and t1.statistical_component = 1)
order by salary_component
""",{
"type": filters['type'],
"company": filters['company']
})