[FIX] {sale_}project: move project_enterprise_tour in project

Before this commit, the `project_enterprise_tour` has a step to
check `allow_billable` field in project to make the new project
billable to get partner field visible. The problem is this step
cannot be achieved if `sale_project` module is not installed.

This commit moves `project_enterprise_tour` is project module
to easily override it in `sale_project` and `project_enterprise`
modules to be sure the tour works when `sale_project` is not installed
and also when that module is installed.

X-original-commit: f09245f4dae4c3503630c9cd92b9d9ab5bfb6e78
Part-of: odoo/odoo#129584
This commit is contained in:
Xavier Bol (xbo)
2023-07-27 00:54:56 +02:00
parent 669b9fcc2f
commit 83706f4d00
3 changed files with 105 additions and 0 deletions
@@ -0,0 +1,81 @@
/** @odoo-module */
import { registry } from "@web/core/registry";
import { stepUtils } from "@web_tour/tour_service/tour_utils";
registry.category("web_tour.tours").add('project_test_tour', {
test: true,
url: '/web',
steps: () => [
stepUtils.showAppsMenuItem(), {
trigger: '.o_app[data-menu-xmlid="project.menu_main_pm"]',
}, {
trigger: '.o-kanban-button-new',
extra_trigger: '.o_project_kanban',
width: 200,
}, {
trigger: '.o_project_name input',
run: 'text New Project',
id: 'project_creation',
}, {
trigger: '.o_open_tasks',
run: function (actions) {
actions.auto('.modal:visible .btn.btn-primary');
},
}, {
trigger: ".o_kanban_project_tasks .o_column_quick_create .input-group",
run: function (actions) {
actions.text("New", this.$anchor.find("input"));
},
}, {
trigger: ".o_kanban_project_tasks .o_column_quick_create .o_kanban_add",
auto: true,
}, {
trigger: ".o_kanban_project_tasks .o_column_quick_create .input-group",
extra_trigger: '.o_kanban_group',
run: function (actions) {
actions.text("Done", this.$anchor.find("input"));
},
}, {
trigger: ".o_kanban_project_tasks .o_column_quick_create .o_kanban_add",
auto: true,
}, {
trigger: '.o-kanban-button-new',
extra_trigger: '.o_kanban_group:eq(0)'
}, {
trigger: '.o_kanban_quick_create div.o_field_char[name=display_name] input',
extra_trigger: '.o_kanban_project_tasks',
run: 'text New task'
}, {
trigger: '.o_kanban_quick_create .o_kanban_add',
extra_trigger: '.o_kanban_project_tasks',
id: "quick_create_tasks",
}, {
trigger: '.o_field_text[name="name"] textarea',
content: 'Set task name',
run: 'text New task',
}, {
trigger: 'div[name="user_ids"].o_field_many2many_tags_avatar input',
content: 'Assign the task to you',
run: 'click',
}, {
trigger: 'ul.ui-autocomplete a .o_avatar_many2x_autocomplete',
content: 'Assign the task to you',
}, {
trigger: 'a[name="sub_tasks_page"]',
content: 'Open sub-tasks notebook section',
run: 'click',
}, {
trigger: '.o_field_subtasks_one2many .o_list_renderer a[role="button"]',
content: 'Add a subtask',
run: 'click',
}, {
trigger: '.o_field_subtasks_one2many div[name="name"] input',
content: 'Set subtask name',
run: 'text new subtask'
}, {
trigger: 'button[special="save"]',
extra_trigger: '.o_field_many2many_tags_avatar .o_m2m_avatar',
content: 'Save task',
},
]});
+3
View File
@@ -26,6 +26,9 @@ This module allows to generate a project/task from sales orders.
'web.assets_backend': [
'sale_project/static/src/components/project_right_side_panel/**/*',
],
'web.assets_tests': [
'sale_project/static/tests/tours/**/*',
],
},
'post_init_hook': '_set_allow_billable_in_project',
'license': 'LGPL-3',
@@ -0,0 +1,21 @@
/** @odoo-module */
/**
* Add custom step to check allow_billable during project creation
* to be able to set a partner on project/tasks.
*/
import { registry } from "@web/core/registry";
import "@project/../tests/tours/project_tour";
import { patch } from "@web/core/utils/patch";
patch(registry.category("web_tour.tours").get("project_test_tour"), "patch_sale_project_tour", {
steps() {
const originalSteps = this._super();
const projectCreationStepIndex = originalSteps.findIndex((step) => step.id === "project_creation");
originalSteps.splice(projectCreationStepIndex, 0, {
trigger: "div[name='allow_billable'] input",
});
return originalSteps;
}
})