From 86eee6246bc501fd706024e7c4e8713cda84bc5a Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Thu, 8 Sep 2016 10:43:25 +0200 Subject: [PATCH] [FIX] hr_timesheet: task creation on project When creating a task on a project which is accessible to followers only, an access error pops up. This comes from the `subtask_project_id` field on the task, which is a related to a `project.project` field. When a task is created, the ORM tries to write on the related field, and hence on `project.project`. opw-687252 --- addons/hr_timesheet/project_timesheet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_timesheet/project_timesheet.py b/addons/hr_timesheet/project_timesheet.py index 8c57ff0da5b..b5e93b4ce99 100644 --- a/addons/hr_timesheet/project_timesheet.py +++ b/addons/hr_timesheet/project_timesheet.py @@ -56,7 +56,7 @@ class Task(models.Model): parent_id = fields.Many2one('project.task', string='Parent Task') child_ids = fields.One2many('project.task', 'parent_id', string="Sub-tasks") - subtask_project_id = fields.Many2one('project.project', related="project_id.subtask_project_id", string='Sub-task Project') + subtask_project_id = fields.Many2one('project.project', related="project_id.subtask_project_id", string='Sub-task Project', readonly=True) subtask_count = fields.Integer(compute='_get_subtask_count', type='integer', string="Sub-task count") _constraints = [(osv.osv._check_recursion, 'Circular references are not permitted between tasks and sub-tasks', ['parent_id'])]