diff --git a/addons/project/static/tests/tours/project_tour.js b/addons/project/static/tests/tours/project_tour.js new file mode 100644 index 00000000000..dbe0a9f9714 --- /dev/null +++ b/addons/project/static/tests/tours/project_tour.js @@ -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', + }, +]}); diff --git a/addons/sale_project/__manifest__.py b/addons/sale_project/__manifest__.py index 73a3d8f5cd8..266dbaa2cef 100644 --- a/addons/sale_project/__manifest__.py +++ b/addons/sale_project/__manifest__.py @@ -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', diff --git a/addons/sale_project/static/tests/tours/project_tour.js b/addons/sale_project/static/tests/tours/project_tour.js new file mode 100644 index 00000000000..fb2479432e1 --- /dev/null +++ b/addons/sale_project/static/tests/tours/project_tour.js @@ -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; + } +})