Merge master
This commit is contained in:
@@ -21,7 +21,9 @@ from recruitment.models import Candidate
|
||||
|
||||
|
||||
@method_decorator(login_required, name="dispatch")
|
||||
@method_decorator(permission_required(perm="candidate.view_candidate"), name="dispatch")
|
||||
@method_decorator(
|
||||
permission_required(perm="recruitment.view_candidate"), name="dispatch"
|
||||
)
|
||||
class OnboardingCandidatesView(TemplateView):
|
||||
"""
|
||||
onboarding candidates view
|
||||
@@ -43,7 +45,9 @@ class OnboardingCandidatesView(TemplateView):
|
||||
|
||||
|
||||
@method_decorator(login_required, name="dispatch")
|
||||
@method_decorator(permission_required(perm="candidate.view_candidate"), name="dispatch")
|
||||
@method_decorator(
|
||||
permission_required(perm="recruitment.view_candidate"), name="dispatch"
|
||||
)
|
||||
class OnboardingCandidatesList(HorillaListView):
|
||||
"""
|
||||
List view
|
||||
@@ -157,7 +161,9 @@ class OnboardingCandidatesList(HorillaListView):
|
||||
|
||||
|
||||
@method_decorator(login_required, name="dispatch")
|
||||
@method_decorator(permission_required(perm="candidate.view_candidate"), name="dispatch")
|
||||
@method_decorator(
|
||||
permission_required(perm="recruitment.view_candidate"), name="dispatch"
|
||||
)
|
||||
class OnboardingCandidatesNav(HorillaNavView):
|
||||
"""
|
||||
Nav bar
|
||||
|
||||
@@ -814,12 +814,21 @@ def generate_payslip(request):
|
||||
end_date = form.cleaned_data["end_date"]
|
||||
|
||||
group_name = form.cleaned_data["group_name"]
|
||||
emp_count = employees.count()
|
||||
for employee in employees:
|
||||
contract = Contract.objects.filter(
|
||||
employee_id=employee, contract_status="active"
|
||||
).first()
|
||||
if start_date < contract.contract_start_date:
|
||||
start_date = contract.contract_start_date
|
||||
|
||||
if end_date < start_date:
|
||||
messages.error(
|
||||
request, _(f"{employee}'s contract has not started yet.")
|
||||
)
|
||||
emp_count -= 1
|
||||
continue
|
||||
|
||||
payslip = payroll_calculation(employee, start_date, end_date)
|
||||
payslips.append(payslip)
|
||||
json_data.append(payslip["json_data"])
|
||||
@@ -854,7 +863,7 @@ def generate_payslip(request):
|
||||
),
|
||||
icon="close",
|
||||
)
|
||||
messages.success(request, f"{employees.count()} payslip saved as draft")
|
||||
messages.success(request, f"{emp_count} payslip saved as draft")
|
||||
return redirect(
|
||||
f"/payroll/view-payslip?group_by=group_name&active_group={group_name}"
|
||||
)
|
||||
|
||||
@@ -144,6 +144,7 @@ class RejectReasonFormView(HorillaFormView):
|
||||
return super().form_valid(form)
|
||||
|
||||
|
||||
@method_decorator(login_required, name="dispatch")
|
||||
class DynamicRejectReasonFormView(HorillaFormView):
|
||||
|
||||
model = RejectReason
|
||||
|
||||
@@ -910,6 +910,10 @@ class CandidateDetail(HorillaDetailedView):
|
||||
)
|
||||
|
||||
|
||||
@method_decorator(login_required, name="dispatch")
|
||||
@method_decorator(
|
||||
all_manager_can_enter(perm="recruitment.change_candidate"), name="dispatch"
|
||||
)
|
||||
class ToSkillZoneFormView(HorillaFormView):
|
||||
"""
|
||||
Form View
|
||||
@@ -980,6 +984,10 @@ class ToSkillZoneFormView(HorillaFormView):
|
||||
return super().form_valid(form)
|
||||
|
||||
|
||||
@method_decorator(login_required, name="dispatch")
|
||||
@method_decorator(
|
||||
all_manager_can_enter(perm="recruitment.change_candidate"), name="dispatch"
|
||||
)
|
||||
class RejectReasonFormView(HorillaFormView):
|
||||
"""
|
||||
Form View
|
||||
|
||||
@@ -210,6 +210,7 @@ class RecruitmentCreationFormExtended(RecruitmentCreationForm):
|
||||
}
|
||||
|
||||
|
||||
@method_decorator(login_required, name="dispatch")
|
||||
class RecruitmentNewSkillForm(HorillaFormView):
|
||||
"""
|
||||
form view for add new skill
|
||||
@@ -287,6 +288,7 @@ class RecruitmentForm(HorillaFormView):
|
||||
return super().form_valid(form)
|
||||
|
||||
|
||||
@method_decorator(login_required, name="dispatch")
|
||||
class AddCandidateFormView(HorillaFormView):
|
||||
"""
|
||||
form view for add candidate
|
||||
|
||||
@@ -38,6 +38,8 @@ class StageView(TemplateView):
|
||||
template_name = "cbv/stages/stages.html"
|
||||
|
||||
|
||||
@method_decorator(login_required, name="dispatch")
|
||||
@method_decorator(permission_required(perm="recruitment.view_stage"), name="dispatch")
|
||||
class StageList(HorillaListView):
|
||||
"""
|
||||
List view of stage
|
||||
@@ -143,6 +145,8 @@ class StageList(HorillaListView):
|
||||
}
|
||||
|
||||
|
||||
@method_decorator(login_required, name="dispatch")
|
||||
@method_decorator(permission_required(perm="recruitment.view_stage"), name="dispatch")
|
||||
class StageNav(HorillaNavView):
|
||||
"""
|
||||
For nav bar
|
||||
@@ -169,6 +173,8 @@ class StageNav(HorillaNavView):
|
||||
group_by_fields = [("recruitment_id", "Recruitment")]
|
||||
|
||||
|
||||
@method_decorator(login_required, name="dispatch")
|
||||
@method_decorator(permission_required(perm="recruitment.add_stage"), name="dispatch")
|
||||
class StageFormView(HorillaFormView):
|
||||
"""
|
||||
Form View
|
||||
@@ -247,6 +253,8 @@ class StageFormView(HorillaFormView):
|
||||
return super().form_valid(form)
|
||||
|
||||
|
||||
@method_decorator(login_required, name="dispatch")
|
||||
@method_decorator(permission_required(perm="recruitment.change_stage"), name="dispatch")
|
||||
class StageDuplicateForm(HorillaFormView):
|
||||
"""
|
||||
Duplicate form view
|
||||
@@ -292,6 +300,8 @@ class StageDuplicateForm(HorillaFormView):
|
||||
return super().form_valid(form)
|
||||
|
||||
|
||||
@method_decorator(login_required, name="dispatch")
|
||||
@method_decorator(permission_required(perm="recruitment.view_stage"), name="dispatch")
|
||||
class StageDetailView(HorillaDetailedView):
|
||||
"""
|
||||
detail view of page
|
||||
|
||||
@@ -322,12 +322,10 @@
|
||||
|
||||
<li class="oh-inner-sidebar__item">
|
||||
<div class="oh-accordion ms-2">
|
||||
{% if employee_section %}
|
||||
<div class="oh-accordion-header" style="font-size:16px;">
|
||||
<ion-icon name="people" class="me-2"></ion-icon>
|
||||
{% trans "Employee" %}
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="oh-accordion-body">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12">
|
||||
@@ -417,9 +415,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{% if employee_section %}
|
||||
<hr>
|
||||
{% endif %}
|
||||
<hr>
|
||||
{% if "attendance"|app_installed %}
|
||||
<li class="oh-inner-sidebar__item">
|
||||
<div class="oh-accordion ms-2">
|
||||
|
||||
Reference in New Issue
Block a user