[UPDT] LEAVE: Introduce can_view_on_leave permission to control On Leave dashboard access
This commit is contained in:
21
leave/migrations/0002_alter_leaverequest_options.py
Normal file
21
leave/migrations/0002_alter_leaverequest_options.py
Normal file
@@ -0,0 +1,21 @@
|
||||
# Generated by Django 5.2.8 on 2025-12-03 09:18
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("leave", "0001_initial"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name="leaverequest",
|
||||
options={
|
||||
"ordering": ["-id"],
|
||||
"permissions": (("can_view_on_leave", "Can View On Leave"),),
|
||||
"verbose_name": "Leave Request",
|
||||
"verbose_name_plural": "Leave Requests",
|
||||
},
|
||||
),
|
||||
]
|
||||
@@ -950,8 +950,9 @@ class LeaveRequest(HorillaModel):
|
||||
|
||||
class Meta:
|
||||
ordering = ["-id"]
|
||||
verbose_name = "Leave Request"
|
||||
verbose_name_plural = "Leave Requests"
|
||||
verbose_name = _("Leave Request")
|
||||
verbose_name_plural = _("Leave Requests")
|
||||
permissions = (("can_view_on_leave", "Can View On Leave"),)
|
||||
|
||||
def comment_action(self):
|
||||
"""
|
||||
|
||||
@@ -763,7 +763,7 @@
|
||||
</div>
|
||||
</div>
|
||||
{% if "leave"|app_installed %}
|
||||
{% if perms.leave.view_leaverequest or request.user|is_reportingmanager %}
|
||||
{% if perms.leave.can_view_on_leave or request.user|is_reportingmanager %}
|
||||
<div class="oh-card-dashboard oh-card-dashboard--no-scale oh-card-dashboard--transparent mb-3">
|
||||
<div class="oh-card-dashboard__header oh-card-dashboard__header--divider">
|
||||
<span class="oh-card-dashboard__title">{% trans "On Leave" %}</span>
|
||||
|
||||
Reference in New Issue
Block a user