From 630727a76d523bf51d2ea0171f4af06f95548b1e Mon Sep 17 00:00:00 2001 From: "Hugo Carlier (Huca)" Date: Tue, 20 Jun 2023 13:33:26 +0000 Subject: [PATCH] [REV] sale_timesheet: initially set hours UoM for timesheet products This commit reverts part of 40c99636c931. Related to #105951 Part-of: odoo/odoo#125813 --- .../static/tests/tours/sale_timesheet_tour.js | 71 +------------------ .../tests/test_sale_timesheet_ui.py | 15 +++- 2 files changed, 17 insertions(+), 69 deletions(-) diff --git a/addons/sale_timesheet/static/tests/tours/sale_timesheet_tour.js b/addons/sale_timesheet/static/tests/tours/sale_timesheet_tour.js index 0f05bdc1a6d..f402185ad4c 100644 --- a/addons/sale_timesheet/static/tests/tours/sale_timesheet_tour.js +++ b/addons/sale_timesheet/static/tests/tours/sale_timesheet_tour.js @@ -9,71 +9,6 @@ registry.category("web_tour.tours").add('sale_timesheet_tour', { url: '/web', steps: [...stepUtils.goToAppSteps("sale.sale_menu_root", 'Go to the Sales App'), { - trigger: 'button[data-menu-xmlid="sale.product_menu_catalog"]', - content: 'Open Products menu', -}, { - trigger: 'a[data-menu-xmlid="sale.menu_product_template_action"]', - content: 'Go to product catalog', -}, { - trigger: 'button.o-kanban-button-new', - content: 'Create a new product', -}, { - trigger: 'textarea.o_input[id="name_0"]', - content: 'Enter a product name (e.g. Service Product Prepaid Hours)', - run: 'text Service Product Prepaid Hours', -}, { - trigger: 'input.o_input[id="uom_id_0"]', - content: 'Default unit should be Units', - run() { - const subjectValue = document.querySelector('input.o_input[id="uom_id_0"]').value; - if (subjectValue !== "Units") { - console.error( - `Default unit should be Units (actual: ${subjectValue})` - ); - } - }, -}, { - trigger: 'input.o_input[id="categ_id_0"]', - content: 'Enter a category name (e.g. Services)', - run: 'text Services', -}, { - trigger: 'a.dropdown-item:contains(Services)', - content: 'Select the ALL / Saleable / Services category', -}, { - trigger: 'select.o_input[id="detailed_type_0"]', - content: 'Select Service product type', - run: 'text "service"', -}, { - trigger: 'select.o_input[id="detailed_type_0"]', - content: 'Select Service product type', - run: 'click', -}, { - trigger: 'input.o_input[id="uom_id_0"]', - content: 'Unit should be set to Hours for a service product', - run() { - const subjectValue = document.querySelector('input.o_input[id="uom_id_0"]').value; - if (subjectValue !== "Hours") { - console.error( - `Default unit should be Hours (actual: ${subjectValue})` - ); - } - }, -}, { - trigger: 'input.o_input[id="list_price_0"]', - content: 'Choose a sales price for that product (e.g. 250$)', - run: 'text 250', -}, { - trigger: 'input.o_input[id="standard_price_0"]', - content: 'Set the cost of that product (e.g. 190$)', - run: 'text 190', -}, { - trigger: 'button[data-menu-xmlid="sale.sale_order_menu"]', - content: 'Open Order menu', -}, { - trigger: 'a[data-menu-xmlid="sale.menu_sale_quotations"]', - content: 'Go to quotations list', -}, { - trigger: 'button.o_list_button_add', content: 'Click on CREATE button to create a quotation with service products.', }, { @@ -89,10 +24,10 @@ registry.category("web_tour.tours").add('sale_timesheet_tour', { content: 'Click on "Add a product" to add a new product. We will add a service product.', }, { trigger: '.o_field_html[name="product_id"], .o_field_widget[name="product_template_id"] input', - content: 'Select a prepaid service product (e.g. Service Product Prepaid Hours)', - run: 'text Service Product Prepaid Hours', + content: Markup('Select a prepaid service product (e.g. Service Product (Prepaid Hours))'), + run: 'text Service Product (Prepaid Hours)', }, { - trigger: 'ul.ui-autocomplete a:contains(Service Product Prepaid Hours)', + trigger: 'ul.ui-autocomplete a:contains(Service Product (Prepaid Hours))', content: 'Select the prepaid service product in the autocomplete dropdown', }, { trigger: 'div[name="product_uom_qty"] input', diff --git a/addons/sale_timesheet/tests/test_sale_timesheet_ui.py b/addons/sale_timesheet/tests/test_sale_timesheet_ui.py index a9011f61cda..c1a0a11fae7 100644 --- a/addons/sale_timesheet/tests/test_sale_timesheet_ui.py +++ b/addons/sale_timesheet/tests/test_sale_timesheet_ui.py @@ -11,9 +11,22 @@ class TestUi(HttpCase): def setUpClass(cls): super().setUpClass() - cls.env['product.category'].create({ + service_category_id = cls.env['product.category'].create({ 'name': 'Services', 'parent_id': cls.env.ref('product.product_category_1').id, + }).id + + uom_hour_id = cls.env.ref('uom.product_uom_hour').id + cls.prepaid_service_product = cls.env['product.product'].create({ + 'name': 'Service Product (Prepaid Hours)', + 'categ_id': service_category_id, + 'type': 'service', + 'list_price': 250.00, + 'standard_price': 190.00, + 'uom_id': uom_hour_id, + 'uom_po_id': uom_hour_id, + 'service_policy': 'ordered_prepaid', + 'service_tracking': 'no', }) # Enable the "Milestones" feature to be able to create milestones on this tour.