-
Notifications
You must be signed in to change notification settings - Fork 23.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] project: hide create task stage option from the project kanban
Due to the project user's inability to create a task stage, we have removed the 'create stage' option from the kanban view. task-3511164 closes #140297 Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
- Loading branch information
Showing
2 changed files
with
90 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
addons/project/static/tests/views/project_task_kanban/project_task_kanban_view_tests.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/* @odoo-module */ | ||
|
||
import { registry } from "@web/core/registry"; | ||
import { startServer } from "@bus/../tests/helpers/mock_python_environment"; | ||
import { addModelNamesToFetch } from "@bus/../tests/helpers/model_definitions_helpers"; | ||
import { makeFakeUserService } from "@web/../tests/helpers/mock_services"; | ||
|
||
import { start } from "@mail/../tests/helpers/test_utils"; | ||
|
||
import { getFixture, click } from "@web/../tests/helpers/utils"; | ||
import { setupViewRegistries } from "@web/../tests/views/helpers"; | ||
|
||
const serviceRegistry = registry.category("services"); | ||
|
||
addModelNamesToFetch(["project.project", "project.task", "project.task.type"]); | ||
|
||
let target; | ||
|
||
QUnit.module('Project', { | ||
beforeEach: async function () { | ||
const pyEnv = await startServer(); | ||
const projectId = pyEnv['project.project'].create([ | ||
{ name: "Project One" }, | ||
]); | ||
const stageId = pyEnv['project.task.type'].create([ | ||
{ name: "New" }, | ||
]); | ||
pyEnv['project.task'].create([ | ||
{ name: 'task one', project_id: projectId, stage_id: stageId }, | ||
]); | ||
this.views = { | ||
"project.task,false,kanban": | ||
`<kanban js_class="project_task_kanban"> | ||
<templates> | ||
<t t-name="kanban-box"> | ||
<div> | ||
<field name="name"/> | ||
</div> | ||
</t> | ||
</templates> | ||
</kanban>`, | ||
}; | ||
target = getFixture(); | ||
setupViewRegistries(); | ||
} | ||
}, function () { | ||
QUnit.test("quick create button is visible when the user has access rights.", async function (assert) { | ||
serviceRegistry.add( | ||
"user", | ||
makeFakeUserService((group) => group === "project.group_project_manager"), | ||
{ force: true }, | ||
); | ||
const { views } = this; | ||
const { openView } = await start({ serverData: { views } }); | ||
await openView({ | ||
res_model: "project.task", | ||
views: [[false, "kanban"]], | ||
context: { | ||
active_model: "project.project", | ||
default_project_id: 1, | ||
group_by: ["stage_id"], | ||
}, | ||
}); | ||
|
||
assert.containsOnce(target, ".o_column_quick_create", "The quick create button should be visible."); | ||
await click(target, ".o_kanban_add_column"); | ||
}); | ||
|
||
QUnit.test("quick create button is not visible when the user not have access rights.", async function (assert) { | ||
const { views } = this; | ||
const { openView } = await start({ serverData: { views } }); | ||
await openView({ | ||
res_model: "project.task", | ||
views: [[false, "kanban"]], | ||
context: { | ||
active_model: "project.project", | ||
default_project_id: 1, | ||
group_by: ["stage_id"], | ||
}, | ||
}); | ||
|
||
assert.containsNone(target, ".o_column_quick_create", "The quick create button should be hidden."); | ||
}); | ||
}); |