From a7cd11612b544643bafaa327406f2eac5ccc58d1 Mon Sep 17 00:00:00 2001 From: Prakash Prajapati Date: Wed, 30 Mar 2022 11:05:16 +0000 Subject: [PATCH] [IMP] project: improve the my tasks/private flow test tasks assigned to the current user should be in the 'inbox' stage by default. tasks with no project set should only be visible to the users assigned to them. task-2723662 Part-of: odoo/odoo#88889 --- addons/project/tests/test_project_flow.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/addons/project/tests/test_project_flow.py b/addons/project/tests/test_project_flow.py index 0b88260ac1f..867cb5ba316 100644 --- a/addons/project/tests/test_project_flow.py +++ b/addons/project/tests/test_project_flow.py @@ -5,6 +5,7 @@ from .test_project_base import TestProjectCommon from odoo import Command from odoo.tools import mute_logger from odoo.addons.mail.tests.common import MockEmail +from odoo.exceptions import AccessError EMAIL_TPL = """Return-Path: @@ -305,6 +306,20 @@ class TestProjectFlow(TestProjectCommon, MockEmail): except Exception as e: raise AssertionError("Error raised unexpectedly while computing a field of the project ! Exception : " + e.args[0]) + # tasks with no project set should only be visible to the users assigned to them + task_without_project.user_ids = [Command.link(self.user_projectuser.id)] + task_without_project.with_user(self.user_projectuser).read(['name']) + with self.assertRaises(AccessError): + task_without_project.with_user(self.user_projectmanager).read(['name']) + + # Tests that tasks assigned to the current user should be in the right default stage + task = self.env['project.task'].create({ + 'name': 'Test Task!', + 'user_ids': [Command.link(self.env.user.id)], + }) + stages = task._get_default_personal_stage_create_vals(self.env.user.id) + self.assertEqual(task.personal_stage_id.stage_id.name, stages[0].get('name'), "tasks assigned to the current user should be in the right default stage") + def test_send_rating_review(self): project_settings = self.env["res.config.settings"].create({'group_project_rating': True}) project_settings.execute()