diff --git a/addons/project/models/project.py b/addons/project/models/project.py index 10b91c7092b..09fef75a8a7 100644 --- a/addons/project/models/project.py +++ b/addons/project/models/project.py @@ -964,8 +964,6 @@ class Task(models.Model): return self.env['project.task'] return children + children._get_all_subtasks() def action_open_parent_task(self): - if self.sudo().parent_id and self.sudo().parent_id.company_id.id not in self.env.companies.ids: - raise UserError(_('The parent task belongs to a company you do not have access to.')) return { 'name': _('Parent Task'), 'view_mode': 'form', @@ -976,8 +974,6 @@ class Task(models.Model): } def action_subtask(self): - if self.sudo().subtask_project_id and self.sudo().subtask_project_id.company_id.id not in self.env.companies.ids: - raise UserError(_('The subtasks belong to a company you do not have access to.')) action = self.env.ref('project.project_task_action_sub_task').read()[0] # display all subtasks of current task diff --git a/addons/project/tests/test_multicompany.py b/addons/project/tests/test_multicompany.py index 3c807ae3e29..5fc6b0187e2 100644 --- a/addons/project/tests/test_multicompany.py +++ b/addons/project/tests/test_multicompany.py @@ -286,14 +286,6 @@ class TestMultiCompanyProject(TestMultiCompanyCommon): self.assertEqual(task.company_id, task.project_id.subtask_project_id.company_id, "The company of the orphan subtask should be the one from its project.") self.assertEqual(self.task_1.child_ids.ids, [task.id]) - # trying to access the subtask in a company not allowed should raise an error - with self.assertRaises(UserError): - self.task_1.with_context(allowed_company_ids=[self.company_a.id]).action_subtask() - - # trying to access the parent task in a company not allowed should raise an error - with self.assertRaises(UserError): - task.with_context(allowed_company_ids=[self.company_b.id]).action_open_parent_task() - with self.sudo('employee-a'): with self.assertRaises(AccessError): with Form(task) as task_form: