[FIX] project: avoid computing recurrence task fields if no project user

Before this commit, when a project user shares a recurrent task to an
internal user, the internal user cannot open the form view of that task
because he does not have access to `project.task.recurrence` model.
The reason is because the compute methods to set the recurrence fields
assumed the user has access to that model.

This commit adds `groups="project.project_group_user"` to recurrent fields
to be sure the user has access to `project.task.recurrence` model before
computing the field.

task-3430762

closes odoo/odoo#148636

X-original-commit: c1623c7c8b1a3c5c69a866b55db77e69958e8754
Related: odoo/enterprise#53911
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
This commit is contained in:
Dhrumil Shah
2024-01-10 08:50:54 +00:00
committed by Xavier Bol (xbo)
parent ed6ab2a698
commit c6c107a3dc
+4 -4
View File
@@ -243,18 +243,18 @@ class Task(models.Model):
recurring_task = fields.Boolean(string="Recurrent")
recurring_count = fields.Integer(string="Tasks in Recurrence", compute='_compute_recurring_count')
recurrence_id = fields.Many2one('project.task.recurrence', copy=False)
repeat_interval = fields.Integer(string='Repeat Every', default=1, compute='_compute_repeat', readonly=False)
repeat_interval = fields.Integer(string='Repeat Every', default=1, compute='_compute_repeat', readonly=False, groups="project.group_project_user")
repeat_unit = fields.Selection([
('day', 'Days'),
('week', 'Weeks'),
('month', 'Months'),
('year', 'Years'),
], default='week', compute='_compute_repeat', readonly=False)
], default='week', compute='_compute_repeat', readonly=False, groups="project.group_project_user")
repeat_type = fields.Selection([
('forever', 'Forever'),
('until', 'Until'),
], default="forever", string="Until", compute='_compute_repeat', readonly=False)
repeat_until = fields.Date(string="End Date", compute='_compute_repeat', readonly=False)
], default="forever", string="Until", compute='_compute_repeat', readonly=False, groups="project.group_project_user")
repeat_until = fields.Date(string="End Date", compute='_compute_repeat', readonly=False, groups="project.group_project_user")
# Account analytic
analytic_account_id = fields.Many2one('account.analytic.account', ondelete='set null', compute='_compute_analytic_account_id', store=True, readonly=False,