Error in leave assignment

App Versions

{
"erpnext": "15.27.6",
"frappe": "15.29.2",
"hrms": "15.22.2",
"my_custom_app": "0.0.1"
}

Route

Form/Leave Policy Assignment/HR-LPOL-ASSGN-00015

Traceback

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 114, in application
    response = frappe.api.handle(request)
  File "apps/frappe/frappe/api/__init__.py", line 49, in handle
    data = endpoint(**arguments)
  File "apps/frappe/frappe/api/v1.py", line 36, in handle_rpc_call
    return frappe.handler.handle()
  File "apps/frappe/frappe/handler.py", line 49, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 85, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1768, in call
    return fn(*args, **newargs)
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
  File "apps/frappe/frappe/desk/form/save.py", line 37, in savedocs
    doc.submit()
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1048, in submit
    return self._submit()
  File "apps/frappe/frappe/model/document.py", line 1031, in _submit
    return self.save()
  File "apps/frappe/frappe/model/document.py", line 337, in save
    return self._save(*args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 390, in _save
    self.run_post_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1131, in run_post_save_methods
    self.run_method("on_submit")
  File "apps/frappe/frappe/model/document.py", line 962, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1322, in composer
    return composed(self, method, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1304, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "apps/frappe/frappe/model/document.py", line 959, in fn
    return method_object(*args, **kwargs)
  File "apps/hrms/hrms/hr/doctype/leave_policy_assignment/leave_policy_assignment.py", line 32, in on_submit
    self.grant_leave_alloc_for_employee()
  File "apps/hrms/hrms/hr/doctype/leave_policy_assignment/leave_policy_assignment.py", line 95, in grant_leave_alloc_for_employee
    leave_allocation, new_leaves_allocated = self.create_leave_allocation(
  File "apps/hrms/hrms/hr/doctype/leave_policy_assignment/leave_policy_assignment.py", line 129, in create_leave_allocation
    allocation.save(ignore_permissions=True)
  File "apps/frappe/frappe/model/document.py", line 337, in save
    return self._save(*args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 359, in _save
    return self.insert()
  File "apps/frappe/frappe/model/document.py", line 291, in insert
    self.run_before_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1091, in run_before_save_methods
    self.run_method("validate")
  File "apps/frappe/frappe/model/document.py", line 966, in run_method
    run_server_script_for_doc_event(self, method)
  File "apps/frappe/frappe/core/doctype/server_script/server_script_utils.py", line 42, in run_server_script_for_doc_event
    frappe.get_doc("Server Script", script_name).execute_doc(doc)
  File "apps/frappe/frappe/core/doctype/server_script/server_script.py", line 169, in execute_doc
    safe_exec(
  File "apps/frappe/frappe/utils/safe_exec.py", line 111, in safe_exec
    exec(
  File "<serverscript>: carryforward", line 1, in <module>
ImportError: __import__ not found

Request Data

{
"type": "POST",
"args": {
"doc": "{\"name\":\"HR-LPOL-ASSGN-00016\",\"owner\":\"prashanth.kolhetkar@nstarxinc.com\",\"creation\":\"2024-06-19 14:39:58.053611\",\"modified\":\"2024-06-19 14:39:58.053611\",\"modified_by\":\"prashanth.kolhetkar@nstarxinc.com\",\"docstatus\":0,\"idx\":0,\"employee\":\"HR-EMP-00024\",\"employee_name\":\"Nitin Pasula\",\"company\":\"nstarxinc\",\"leave_policy\":\"HR-LPOL-2024-00006\",\"carry_forward\":0,\"assignment_based_on\":\"Leave Period\",\"leave_period\":\"HR-LPR-2024-00003\",\"effective_from\":\"2024-01-01\",\"effective_to\":\"2024-12-31\",\"leaves_allocated\":0,\"amended_from\":null,\"doctype\":\"Leave Policy Assignment\",\"__last_sync_on\":\"2024-06-19T09:09:59.073Z\"}",
"action": "Submit"
},
"btn": {
"jQuery370090903475760053111": {
"events": {
"click": [
{
"type": "click",
"origType": "click",
"guid": 3147,
"namespace": ""
}
]
}
}
},
"freeze": true,
"headers": {},
"error_handlers": {},
"url": "/api/method/frappe.desk.form.save.savedocs",
"request_id": null
}

Response Data

{
"exception": "ImportError: __import__ not found",
"exc_type": "ImportError",
"_exc_source": "Server Script"
}

Is any server script applied or not? if applied then remove or comment it.

@NCP Thanks after removing its working

@NCP Could you please check this " Data import issue in designation doc"

check it: Data import issue in designation doc - #5 by NCP