From eb2d91ec016f90cc425023ba2ed2103eb7299c48 Mon Sep 17 00:00:00 2001 From: "Thomas Lefebvre (thle)" Date: Wed, 22 Mar 2023 12:21:13 +0000 Subject: [PATCH] [FIX] hr_timesheet_attendance: remove project_id field in rule Issue: A user being in the group `group_hr_timesheet_approver` will have a traceback if he goes to "Timesheets / Reporting / Timesheet/Attendance". Cause: The `project_id` field does not exist on the `hr.timesheet.attendance.report` model. Solution: It is acceptable for the `group_hr_timesheet_approver` group to have the same access rights than the `group_timesheet_manager` group. opw-3221963 closes odoo/odoo#116741 X-original-commit: 9d0bc00eff0f9290b401f648f865fd591ad5fca0 Signed-off-by: Xavier Bol (xbo) --- addons/hr_timesheet_attendance/__manifest__.py | 2 +- .../hr_timesheet_attendance_report_security.xml | 7 +------ .../upgrades/1.1/pre-migrate.py | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 7 deletions(-) create mode 100644 addons/hr_timesheet_attendance/upgrades/1.1/pre-migrate.py diff --git a/addons/hr_timesheet_attendance/__manifest__.py b/addons/hr_timesheet_attendance/__manifest__.py index 82aa866ef42..4a1f3c1114a 100644 --- a/addons/hr_timesheet_attendance/__manifest__.py +++ b/addons/hr_timesheet_attendance/__manifest__.py @@ -7,7 +7,7 @@ Module linking the attendance module to the timesheet app. """, 'category': 'Hidden', - 'version': '1.0', + 'version': '1.1', 'depends': ['hr_timesheet', 'hr_attendance'], 'data': [ diff --git a/addons/hr_timesheet_attendance/security/hr_timesheet_attendance_report_security.xml b/addons/hr_timesheet_attendance/security/hr_timesheet_attendance_report_security.xml index 19ef67d512e..ced1decaec9 100644 --- a/addons/hr_timesheet_attendance/security/hr_timesheet_attendance_report_security.xml +++ b/addons/hr_timesheet_attendance/security/hr_timesheet_attendance_report_security.xml @@ -16,12 +16,7 @@ Timesheet attendance Report: Approver - [ - ('project_id', '!=', False), - '|', - ('project_id.privacy_visibility', '!=', 'followers'), - ('project_id.message_partner_ids', 'in', [user.partner_id.id]) - ] + [(1, '=', 1)] diff --git a/addons/hr_timesheet_attendance/upgrades/1.1/pre-migrate.py b/addons/hr_timesheet_attendance/upgrades/1.1/pre-migrate.py new file mode 100644 index 00000000000..4612246b41c --- /dev/null +++ b/addons/hr_timesheet_attendance/upgrades/1.1/pre-migrate.py @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + + +def migrate(cr, version): + cr.execute(""" + UPDATE ir_rule r + SET domain_force = '[(1, "=", 1)]' + FROM ir_model_data d + WHERE d.res_id = r.id + AND d.model = 'ir.rule' + AND d.module = 'hr_timesheet_attendance' + AND d.name = 'hr_timesheet_attendance_report_rule_approver' + """)