Allow staff work assignments across financial years

This commit is contained in:
A R R R Associates
2026-08-26 17:27:32 +05:30
parent 33410ea141
commit 436a0e0766
3 changed files with 51 additions and 20 deletions
+16 -15
View File
@@ -1934,7 +1934,7 @@ def employee_work_assignment_dashboard(
selected_assigned_to_user_id=assignee_id,
scope=scope,
errors=[],
financial_year=financial_year,
financial_year=selected_financial_year or "",
)
finally:
db.close()
@@ -2018,7 +2018,7 @@ def employee_my_work_task_status(
status=status,
remarks=remarks,
actor_user_id=current_user.id,
financial_year=_active_financial_year(request),
financial_year=None,
)
safe_return_url = return_url if return_url.startswith("/employee/work") else "/employee/work"
return RedirectResponse(url=safe_return_url, status_code=303)
@@ -2031,6 +2031,7 @@ def employee_my_work(
request: Request,
q: str = "",
status: str = "open",
financial_year: str = "",
period: str = "",
service: str = "",
due: str = "",
@@ -2054,13 +2055,13 @@ def employee_my_work(
branch_id = request.session.get("active_branch_id")
scope = build_employee_scope(db, current_user, tenant_id=tenant_id, branch_id=branch_id)
employee = get_employee_for_user(db, current_user)
financial_year = _active_financial_year(request)
selected_financial_year = (financial_year or "").strip() or None
work_payload = list_employee_work_kanban(
db,
scope,
q=q,
status=status,
financial_year=financial_year,
financial_year=selected_financial_year,
period=period,
service=service,
due_bucket=due,
@@ -2125,7 +2126,7 @@ def employee_my_work_engagement_start(
scope,
engagement_id,
actor_user_id=current_user.id,
financial_year=_active_financial_year(request),
financial_year=None,
)
return RedirectResponse(
url=f"/employee/work/engagements/{engagement_id}",
@@ -2150,7 +2151,7 @@ def employee_my_work_engagement_board(request: Request, engagement_id: int, task
branch_id = request.session.get("active_branch_id")
scope = build_employee_scope(db, current_user, tenant_id=tenant_id, branch_id=branch_id)
employee = get_employee_for_user(db, current_user)
financial_year = _active_financial_year(request)
financial_year = None
board = get_employee_engagement_work_board(
db,
scope,
@@ -2185,7 +2186,7 @@ def employee_workflow_pause(request: Request, engagement_id: int, reason: str =
except PermissionError: return _csrf_rejected(request)
scope = build_employee_scope(db, current_user, tenant_id=request.session.get("active_tenant_id") or current_user.tenant_id, branch_id=request.session.get("active_branch_id"))
try:
pause_employee_engagement_workflow(db, scope, engagement_id, reason=reason, notes=notes, follow_up_date=follow_up_date, actor_user_id=current_user.id, financial_year=_active_financial_year(request))
pause_employee_engagement_workflow(db, scope, engagement_id, reason=reason, notes=notes, follow_up_date=follow_up_date, actor_user_id=current_user.id, financial_year=None)
except ValueError:
db.rollback(); return RedirectResponse(url=f"/employee/work/engagements/{engagement_id}?pause_error=1", status_code=303)
return RedirectResponse(url=f"/employee/work/engagements/{engagement_id}?paused=1", status_code=303)
@@ -2204,7 +2205,7 @@ def employee_workflow_resume(request: Request, engagement_id: int, csrf_token: s
except PermissionError: return _csrf_rejected(request)
scope = build_employee_scope(db, current_user, tenant_id=request.session.get("active_tenant_id") or current_user.tenant_id, branch_id=request.session.get("active_branch_id"))
try:
resume_employee_engagement_workflow(db, scope, engagement_id, actor_user_id=current_user.id, financial_year=_active_financial_year(request))
resume_employee_engagement_workflow(db, scope, engagement_id, actor_user_id=current_user.id, financial_year=None)
except ValueError:
db.rollback(); return RedirectResponse(url=f"/employee/work/engagements/{engagement_id}?resume_error=1", status_code=303)
return RedirectResponse(url=f"/employee/work/engagements/{engagement_id}?resumed=1", status_code=303)
@@ -2234,7 +2235,7 @@ def employee_workflow_escalate(
escalate_employee_engagement_workflow(
db, scope, engagement_id, level=level, message=message,
actor_user_id=current_user.id,
financial_year=request.session.get("active_financial_year"),
financial_year=None,
)
except ValueError:
db.rollback()
@@ -2277,7 +2278,7 @@ def employee_workflow_task_quick_action(
action=action,
reason=reason,
actor_user_id=current_user.id,
financial_year=_active_financial_year(request),
financial_year=None,
)
except ValueError as exc:
db.rollback()
@@ -2341,7 +2342,7 @@ def employee_workflow_task_save(
checklist_date_response=checklist_date_response,
checklist_remarks=checklist_remarks,
actor_user_id=current_user.id,
financial_year=_active_financial_year(request),
financial_year=None,
)
except ValueError:
db.rollback()
@@ -2431,7 +2432,7 @@ def employee_work_task_add_communication(
visibility=visibility,
message=message,
actor_user_id=current_user.id,
financial_year=_active_financial_year(request),
financial_year=None,
)
return RedirectResponse(url=_safe_employee_return_url(return_to, f"/employees/work/tasks/{task_id}/communication"), status_code=303)
finally:
@@ -2455,7 +2456,7 @@ def employee_my_work_task_communication(
tenant_id = request.session.get("active_tenant_id") or current_user.tenant_id
branch_id = request.session.get("active_branch_id")
scope = build_employee_scope(db, current_user, tenant_id=tenant_id, branch_id=branch_id)
financial_year = _active_financial_year(request)
financial_year = None
task = get_work_task_with_communications(db, scope, task_id, assigned_only=True, financial_year=financial_year)
return _render(
request,
@@ -2512,7 +2513,7 @@ def employee_my_work_task_add_communication(
message=message,
actor_user_id=current_user.id,
assigned_only=True,
financial_year=_active_financial_year(request),
financial_year=None,
)
return RedirectResponse(url=_safe_employee_return_url(return_to, f"/employee/work/tasks/{task_id}/communication"), status_code=303)
finally:
@@ -2870,7 +2871,7 @@ def _employee_portal_context(request: Request, db, current_user, *, active_tab:
scope,
q="",
status="open",
financial_year=_active_financial_year(request),
financial_year=None,
)
return {
"title": "Employee Portal",