Skip to content

Commit

Permalink
feat: add Branch filter and make Bulk Assign Structure primary key
Browse files Browse the repository at this point in the history
  • Loading branch information
krantheman committed Dec 19, 2023
1 parent 1bcc636 commit 5ea36ac
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions hrms/payroll/doctype/salary_structure/salary_structure.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,11 @@ frappe.ui.form.on("Salary Structure", {
frm.fields_dict['deductions'].grid.set_column_disp("default_amount", false);

if (frm.doc.docstatus === 1) {
frm.add_custom_button(__("Assign to Employees"), function() {
frm.page.set_primary_action(__("Bulk Assign Structure"), () => {
frm.trigger("assign_to_employees")
}, __("Actions"));
})

frm.add_custom_button(__("Assign Salary Structure"), function() {
frm.add_custom_button(__("Assign to Single Employee"), function() {
let doc = frappe.model.get_new_doc("Salary Structure Assignment");
doc.salary_structure = frm.doc.name;
doc.company = frm.doc.company;
Expand All @@ -127,12 +127,13 @@ frappe.ui.form.on("Salary Structure", {

assign_to_employees:function (frm) {
var d = new frappe.ui.Dialog({
title: __("Assign to Employees"),
title: __("Bulk Salary Structure Assignment"),
fields: [
{fieldname: "sec_break", fieldtype: "Section Break", label: __("Filter Employees By (Optional)")},
{fieldname: "grade", fieldtype: "Link", options: "Employee Grade", label: __("Employee Grade")},
{fieldname:'department', fieldtype:'Link', options: 'Department', label: __('Department')},
{fieldname: "sec_break", fieldtype: "Section Break", label: __("Employee Filters")},
{fieldname: "branch", fieldtype: "Link", options: "Branch", label: __("Branch")},
{fieldname:'designation', fieldtype:'Link', options: 'Designation', label: __('Designation')},
{fieldname:'department', fieldtype:'Link', options: 'Department', label: __('Department')},
{fieldname: "grade", fieldtype: "Link", options: "Employee Grade", label: __("Employee Grade")},
{fieldname:"employee", fieldtype: "Link", options: "Employee", label: __("Employee")},
{fieldname:"payroll_payable_account", fieldtype: "Link", options: "Account", filters: {"company": frm.doc.company, "root_type": "Liability", "is_group": 0, "account_currency": frm.doc.currency}, label: __("Payroll Payable Account")},
{fieldname:'base_variable', fieldtype:'Section Break'},
Expand Down

0 comments on commit 5ea36ac

Please sign in to comment.