[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
This commit is contained in:
Nicolas Martinelli
2016-09-08 10:43:25 +02:00
parent 49b807d877
commit 86eee6246b
+1 -1
View File
@@ -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'])]