[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) <xbo@odoo.com>
This commit is contained in:
Thomas Lefebvre (thle)
2023-03-27 20:06:52 +02:00
committed by Xavier Bol (xbo)
parent 9b2c39df36
commit eb2d91ec01
3 changed files with 16 additions and 7 deletions
@@ -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': [
@@ -16,12 +16,7 @@
<record id="hr_timesheet_attendance_report_rule_approver" model="ir.rule">
<field name="name">Timesheet attendance Report: Approver</field>
<field name="model_id" ref="model_hr_timesheet_attendance_report"/>
<field name="domain_force">[
('project_id', '!=', False),
'|',
('project_id.privacy_visibility', '!=', 'followers'),
('project_id.message_partner_ids', 'in', [user.partner_id.id])
]</field>
<field name="domain_force">[(1, '=', 1)]</field>
<field name="groups" eval="[(4, ref('hr_timesheet.group_hr_timesheet_approver'))]"/>
</record>
@@ -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'
""")