[FIX] OFFBOARDING: Fixed decorators and changed request call from init to get context
This commit is contained in:
@@ -92,6 +92,7 @@ class OffboardingStageFormView(HorillaFormView):
|
||||
return super().form_valid(form)
|
||||
|
||||
|
||||
@method_decorator(login_required, name="dispatch")
|
||||
@method_decorator(
|
||||
any_manager_can_enter("offboarding.add_offboardingemployee"), name="dispatch"
|
||||
)
|
||||
@@ -324,8 +325,8 @@ class PipeLineTabView(HorillaTabView):
|
||||
|
||||
filter_class = PipelineFilter
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
offboardings = self.filter_class(self.request.GET).qs.filter(is_active=True)
|
||||
view_type = self.request.GET.get("view", "list")
|
||||
self.tabs = []
|
||||
@@ -400,6 +401,9 @@ class PipeLineTabView(HorillaTabView):
|
||||
|
||||
self.tabs.append(tab)
|
||||
|
||||
context["tabs"] = self.tabs
|
||||
return context
|
||||
|
||||
|
||||
@method_decorator(login_required, name="dispatch")
|
||||
class OffboardingPipelineStage(Pipeline):
|
||||
@@ -661,6 +665,10 @@ class OffboardingEmployeeList(HorillaListView):
|
||||
self.view_id = (
|
||||
f"offboardingStageContainer{self.request.GET.get('offboarding_stage_id')}"
|
||||
)
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
|
||||
self.managing_offboarding_tasks = OffboardingTask.objects.filter(
|
||||
managers__employee_user_id=self.request.user
|
||||
).values_list("pk", flat=True)
|
||||
@@ -676,10 +684,8 @@ class OffboardingEmployeeList(HorillaListView):
|
||||
).values_list("pk", flat=True)
|
||||
self.request.managing_offboardings = self.managing_offboardings
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
stage_id = self.request.GET["offboarding_stage_id"]
|
||||
tasks = OffboardingTask.objects.filter(stage_id=stage_id)
|
||||
context = super().get_context_data(**kwargs)
|
||||
for task in tasks:
|
||||
context["columns"].append(
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user