fix: Create salary slip button disappears

This commit is contained in:
Anurag Mishra 2020-06-24 15:22:45 +05:30
parent 8ffb9f852f
commit 020c6e9175

View File

@ -30,6 +30,7 @@ frappe.ui.form.on('Payroll Entry', {
).toggleClass('btn-primary', !(frm.doc.employees || []).length);
}
if ((frm.doc.employees || []).length) {
frm.page.clear_primary_action();
frm.page.set_primary_action(__('Create Salary Slips'), () => {
frm.save('Submit').then(()=>{
frm.page.clear_primary_action();
@ -49,13 +50,14 @@ frappe.ui.form.on('Payroll Entry', {
return frappe.call({
doc: frm.doc,
method: 'fill_employee_details',
callback: function(r) {
if (r.docs[0].employees){
frm.save();
frm.refresh();
if(r.docs[0].validate_attendance){
render_employee_attendance(frm, r.message);
}
}).then(r => {
if (r.docs[0].employees){
frm.employees = r.docs[0].employees;
frm.dirty();
frm.save();
frm.refresh();
if(r.docs[0].validate_attendance){
render_employee_attendance(frm, r.message);
}
}
})