From acd0adc0ed55758a048a34d6d4ead4bed300b549 Mon Sep 17 00:00:00 2001 From: Alexander Bigga Date: Wed, 24 May 2023 15:49:27 +0200 Subject: [PATCH] verdigado_attendance: allow manager again to read employees attendances --- verdigado_attendance/Readme.md | 4 ++++ verdigado_attendance/__manifest__.py | 1 + verdigado_attendance/models/__init__.py | 3 +++ verdigado_attendance/models/hr_attendance.py | 11 +++++++++++ .../hr_attendance_rule_attendance_manager.xml | 17 +++++++++++++++++ 5 files changed, 36 insertions(+) create mode 100644 verdigado_attendance/models/__init__.py create mode 100644 verdigado_attendance/models/hr_attendance.py create mode 100644 verdigado_attendance/security/hr_attendance_rule_attendance_manager.xml diff --git a/verdigado_attendance/Readme.md b/verdigado_attendance/Readme.md index 1709143..2d5031f 100644 --- a/verdigado_attendance/Readme.md +++ b/verdigado_attendance/Readme.md @@ -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. diff --git a/verdigado_attendance/__manifest__.py b/verdigado_attendance/__manifest__.py index ab536f8..100f232 100644 --- a/verdigado_attendance/__manifest__.py +++ b/verdigado_attendance/__manifest__.py @@ -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", diff --git a/verdigado_attendance/models/__init__.py b/verdigado_attendance/models/__init__.py new file mode 100644 index 0000000..ecc4b85 --- /dev/null +++ b/verdigado_attendance/models/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +from . import hr_attendance diff --git a/verdigado_attendance/models/hr_attendance.py b/verdigado_attendance/models/hr_attendance.py new file mode 100644 index 0000000..3a9145b --- /dev/null +++ b/verdigado_attendance/models/hr_attendance.py @@ -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" diff --git a/verdigado_attendance/security/hr_attendance_rule_attendance_manager.xml b/verdigado_attendance/security/hr_attendance_rule_attendance_manager.xml new file mode 100644 index 0000000..12fdfb6 --- /dev/null +++ b/verdigado_attendance/security/hr_attendance_rule_attendance_manager.xml @@ -0,0 +1,17 @@ + + + + verdigado: allow Manager read employee's attendance + + ['|', '|', ('employee_id.user_id','=',user.id), ('employee_id.parent_id.user_id','=',user.id), ('attendance_admin.user_id','=',user.id)] + + + + + + +