Skip to content

Commit

Permalink
verdigado_attendance: allow manager again to read employees attendances
Browse files Browse the repository at this point in the history
  • Loading branch information
albig committed May 24, 2023
1 parent aa6c463 commit acd0adc
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 0 deletions.
4 changes: 4 additions & 0 deletions verdigado_attendance/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,7 @@ access_resource_calendar_officer_verdigado,resource.calendar.system,resource.mod
```
access_resource_calendar_attendance_officer_verdigado,resource.calendar.attendance.system,resource.model_resource_calendar_attendance,hr.group_hr_manager,1,1,1,1
```

4. Allow Manager read employee's attendance

Module `hr_attendance_sheet` removes read access of attendance records for managers. We revert this change.
1 change: 1 addition & 0 deletions verdigado_attendance/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"data": [
'data/res.lang.csv',
"security/ir.model.access.csv",
"security/hr_attendance_rule_attendance_manager.xml",
"views/hr_attendance_view.xml",
"views/hr_attendance_theoretical_time_report.xml",
"views/hr_menu_human_resources_configuration.xml",
Expand Down
3 changes: 3 additions & 0 deletions verdigado_attendance/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from . import hr_attendance
11 changes: 11 additions & 0 deletions verdigado_attendance/models/hr_attendance.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

#
# dummy model to allow verdigado_hr_attendance_rule_attendance_manager rule
#

from odoo import _, api, fields, models
from odoo.exceptions import UserError

class HrAttendance(models.Model):
_inherit = "hr.attendance"
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="verdigado_hr_attendance_rule_attendance_manager" model="ir.rule">
<field
name="name"
>verdigado: allow Manager read employee's attendance</field>
<field name="model_id" ref="model_hr_attendance" />
<field
name="domain_force"
>['|', '|', ('employee_id.user_id','=',user.id), ('employee_id.parent_id.user_id','=',user.id), ('attendance_admin.user_id','=',user.id)]</field>
<field name="perm_read" eval="True" />
<field name="perm_write" eval="True" />
<field name="perm_create" eval="True" />
<field name="perm_unlink" eval="False" />
<field name="groups" eval="[(4,ref('hr_attendance.group_hr_attendance'))]" />
</record>
</odoo>

0 comments on commit acd0adc

Please sign in to comment.