Skip to content

Commit

Permalink
Merge pull request #417 from saurabh6790/profiling-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ruchamahabal authored May 10, 2023
2 parents 5598344 + 8c62ef4 commit 7579a94
Show file tree
Hide file tree
Showing 5 changed files with 630 additions and 478 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def test_employee_benefit_application(self):
include_flexi_benefits=True,
employee=employee,
payroll_period=payroll_period,
company="_Test Company",
)
salary_slip = make_salary_slip(salary_structure.name, employee=employee, posting_date=getdate())
salary_slip.insert()
Expand Down
38 changes: 25 additions & 13 deletions hrms/payroll/doctype/payroll_entry/payroll_entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ frappe.ui.form.on('Payroll Entry', {
});
});
} else if (frm.doc.docstatus == 1 && frm.doc.status == "Failed") {
frm.add_custom_button(__("Create Salary Slip"), function () {
frm.add_custom_button(__("Create Salary Slips"), function () {
frm.call("create_salary_slips", {}, () => {
frm.reload_doc();
});
Expand Down Expand Up @@ -105,24 +105,32 @@ frappe.ui.form.on('Payroll Entry', {
return frappe.call({
doc: frm.doc,
method: 'fill_employee_details',
freeze: true,
freeze_message: __('Fetching Employees')
}).then(r => {
if (r.docs && r.docs[0].employees) {
frm.employees = r.docs[0].employees;
if (r.docs?.[0]?.employees) {
frm.dirty();
frm.save();
frm.refresh();
if (r.docs[0].validate_attendance) {
render_employee_attendance(frm, r.message);
}
frm.scroll_to_field("employees");
}

frm.refresh();

if (r.docs?.[0]?.validate_attendance) {
render_employee_attendance(frm, r.message);
}
frm.scroll_to_field("employees");
});
},

create_salary_slips: function (frm) {
frm.call({
doc: frm.doc,
method: "create_salary_slips",
method: "run_doc_method",
args: {
method: "create_salary_slips",
dt: "Payroll Entry",
dn: frm.doc.name
},
callback: function () {
frm.reload_doc();
frm.toolbar.refresh();
Expand Down Expand Up @@ -337,9 +345,9 @@ frappe.ui.form.on('Payroll Entry', {
},

validate_attendance: function (frm) {
if (frm.doc.validate_attendance && frm.doc.employees) {
if (frm.doc.validate_attendance && (frm.doc.employees?.length > 0)) {
frappe.call({
method: 'validate_employee_attendance',
method: 'get_employees_to_mark_attendance',
args: {},
callback: function (r) {
render_employee_attendance(frm, r.message);
Expand Down Expand Up @@ -389,8 +397,12 @@ let make_bank_entry = function (frm) {
var doc = frm.doc;
if (doc.payment_account) {
return frappe.call({
doc: cur_frm.doc,
method: "make_payment_entry",
method: "run_doc_method",
args: {
method: "make_payment_entry",
dt: "Payroll Entry",
dn: frm.doc.name
},
callback: function () {
frappe.set_route(
'List', 'Journal Entry', {
Expand Down
Loading

0 comments on commit 7579a94

Please sign in to comment.