Error while Bulk Salary creation

Traceback with variables (most recent call last):
File “apps/hrms/hrms/payroll/doctype/payroll_entry/payroll_entry.py”, line 1206, in create_salary_slips_for_employees
frappe.get_doc(args).insert()
employees = [‘HR-EMP-00135’, ‘HR-EMP-00132’, ‘HR-EMP-00137’, ‘HR-EMP-00131’, ‘HR-EMP-00115’, ‘HR-EMP-00108’, ‘HR-EMP-00107’, ‘HR-EMP-00134’, ‘HR-EMP-00119’, ‘HR-EMP-00117’, ‘HR-EMP-00140’, ‘HR-EMP-00136’, ‘HR-EMP-00105’, ‘HR-EMP-00113’, ‘HR-EMP-00111’, ‘HR-EMP-00133’, ‘HR-EMP-00110’, ‘HR-EMP-00118’, ‘HR-EMP-00116’, ‘HR-EMP-00114’]
args = {‘salary_slip_based_on_timesheet’: 0, ‘payroll_frequency’: ‘Monthly’, ‘start_date’: ‘2023-09-01’, ‘end_date’: ‘2023-09-30’, ‘company’: ‘Gurukrupa Exports - Live’, ‘posting_date’: ‘2024-01-23’, ‘deduct_tax_for_unclaimed_employee_benefits’: 0, ‘deduct_tax_for_unsubmitted_tax_exemption_proof’: 0, ‘payroll_entry’: ‘HR-PRUN-2024-00001’, ‘exchange_rate’: 1, ‘currency’: ‘INR’, ‘doctype’: ‘Salary Slip’, ‘employee’: ‘HR-EMP-00132’}
publish_progress = False
payroll_entry = <PayrollEntry: HR-PRUN-2024-00001 docstatus=1>
salary_slips_exist_for = []
count = 1
emp = ‘HR-EMP-00132’
e = UnboundLocalError(“local variable ‘early_exit_by’ referenced before assignment”)
File “apps/frappe/frappe/model/document.py”, line 262, in insert
self.run_before_save_methods()
self = <SalarySlip: Sal Slip/HR-EMP-00132/00001>
ignore_permissions = None
ignore_links = None
ignore_if_duplicate = False
ignore_mandatory = None
set_name = None
set_child_names = True
File “apps/frappe/frappe/model/document.py”, line 1051, in run_before_save_methods
self.run_method(“validate”)
self = <SalarySlip: Sal Slip/HR-EMP-00132/00001>
File “apps/frappe/frappe/model/document.py”, line 919, in run_method
run_server_script_for_doc_event(self, method)
self = <SalarySlip: Sal Slip/HR-EMP-00132/00001>
args = ()
kwargs = {}
fn = <function Document.run_method..fn at 0x7fa1f6637ac0>
out = None
method = ‘validate’
File “apps/frappe/frappe/core/doctype/server_script/server_script_utils.py”, line 39, in run_server_script_for_doc_event
frappe.get_doc(“Server Script”, script_name).execute_doc(doc)
doc = <SalarySlip: Sal Slip/HR-EMP-00132/00001>
event = ‘validate’
scripts = [‘Calculate Working Hours’]
script_name = ‘Calculate Working Hours’
File “apps/frappe/frappe/core/doctype/server_script/server_script.py”, line 106, in execute_doc
safe_exec(self.script, _locals={“doc”: doc}, restrict_commit_rollback=True)
self = <ServerScript: Calculate Working Hours>
doc = <SalarySlip: Sal Slip/HR-EMP-00132/00001>
File “apps/frappe/frappe/utils/safe_exec.py”, line 85, in safe_exec
exec(
script = '\ndef main(doc):\n def get_attendance_details():\n '''\n return {\n “01-01-2023” : {“working_hrs”:“10.25”, “late_entry”: 0},\n }\n '''\n attendance_details = {}\n\n for attendance in frappe.db.get_all(“Attendance”, filters={\n “employee”: doc.employee,\n “attendance_date”: (“between”, (doc.start_date, doc.end_date)),\n “status”: (“Not In”, (“Absent”, “On Leave”)),\n “shift”: (“is”, “set”),\n “docstatus”: 1\n }, \n fields=[\n “attendance_date”, “net_working_hrs”,\n “working_hours”, “late_entry”, “name”, “early_exit”], \n order_by=“attendance_date asc”\n ):\n working_hrs = attendance.working_hours\n checkin = get_employee_checkin_details(attendance.name, “IN”)\n if checkin:\n late_in_by = frappe.utils.time_diff_in_hours(che…
_globals = None
_locals = {‘doc’: <SalarySlip: Sal Slip/HR-EMP-00132/00001>, ‘main’: <function main at 0x7fa1f468ac20>}
restrict_commit_rollback = True
enabled = True
exec_globals = {‘json’: {‘loads’: <function loads at 0x7fa1fac4f130>, ‘dumps’: <function dumps at 0x7fa1fac4eb90>}, ‘as_json’: <function as_json at 0x7fa1fa040af0>, ‘dict’: <class ‘dict’>, ‘log’: <function log at 0x7fa1fa025ea0>, ‘_dict’: <class 'frappe.dict’>, ‘args’: {‘doc’: '{“name”:“HR-PRUN-2024-00001”,“owner”:“viralchachadiya@gurukrupaexport.in”,“creation”:“2024-01-23 13:28:44.357686”,“modified”:“2024-01-25 08:52:50.376563”,“modified_by”:“harsh@gurukrupaexport.in”,“docstatus”:0,“idx”:0,“posting_date”:“2024-01-23”,“company”:“Gurukrupa Exports - Live”,“currency”:“INR”,“exchange_rate”:1,“payroll_payable_account”:“Payroll Payable - GE-L”,“status”:“Failed”,“salary_slip_based_on_timesheet”:0,“payroll_frequency”:“Monthly”,“start_date”:“2023-09-01”,“end_date”:“2023-09-30”,“deduct_tax_for_unclaimed_employee_benefits”:0,“deduct_tax_for_unsubmitted_tax_exemption_proof”:0,“number_of_employees”:20,“validate_attendance”:0,“cost_center”:“Main - GE-L”,“salary_slips_created”:0,“salary_slips_submitted”:0,"error
File “”, line 303, in
doc = <SalarySlip: Sal Slip/HR-EMP-00132/00001>
main = <function main at 0x7fa1f468ac20>
File “”, line 208, in main
get_attendance_details = <function main..get_attendance_details at 0x7fa1f468b2e0>
get_shift = <function main..get_shift at 0x7fa1f468a440>
get_working_hours_for_leaves = <function main..get_working_hours_for_leaves at 0x7fa1f468a3b0>
get_working_hours_for_holidays = <function main..get_working_hours_for_holidays at 0x7fa1f468a4d0>
get_weekly_off_dates = <function main..get_weekly_off_dates at 0x7fa1f4689f30>
get_start_and_end_date = <function main..get_start_and_end_date at 0x7fa1f4688ca0>
get_holiday_list_for_employee = <function main..get_holiday_list_for_employee at 0x7fa1f46881f0>
get_approved_ot_log = <function main..get_approved_ot_log at 0x7fa1f468b250>
get_total_personal_outs = <function main..get_total_personal_outs at 0x7fa1f468b400>
clear_default_amount = <function main..clear_default_amount at 0x7fa1f468a200>
shift = ‘8:00 to 18:00’
dates = (datetime.date(2023, 9, 20), datetime.date(2023, 9, 30))
holiday_list = ‘GK 2023’
leave_hours = 0.0
holiday_hours = 0.0
doc = <SalarySlip: Sal Slip/HR-EMP-00132/00001>
get_employee_checkin_details = <function main..get_employee_checkin_details at 0x7fa1f4688310>
get_holidays = <function main..get_holidays at 0x7fa1f468a5f0>
File “”, line 45, in get_attendance_details
attendance_details = {}
attendance = {‘attendance_date’: datetime.date(2023, 9, 29), ‘net_working_hrs’: 0.0, ‘working_hours’: 0.0, ‘late_entry’: 1, ‘name’: ‘HR-ATT-2023-10194’, ‘early_exit’: 0}
working_hrs = 0.0
checkin = [{‘shift_start’: datetime.datetime(2023, 9, 29, 8, 0), ‘time’: datetime.datetime(2023, 9, 29, 18, 10, 29), ‘shift_end’: datetime.datetime(2023, 9, 29, 18, 0)}]
late_in_by = 10.174722
checkout = []
doc = <SalarySlip: Sal Slip/HR-EMP-00132/00001>
get_employee_checkin_details = <function main..get_employee_checkin_details at 0x7fa1f4688310>
builtins.UnboundLocalError: local variable ‘early_exit_by’ referenced before assignment

At first look, seems that a variable early_exit_by has been read (accessed) before it was defined or before its values was set. Check Your form filled values or create a bug report as this issue may not be upon You