[REV] sale_timesheet: initially set hours UoM for timesheet products

This commit reverts part of 40c99636c9.

Related to #105951

Part-of: odoo/odoo#125813
This commit is contained in:
Hugo Carlier (Huca)
2023-06-22 18:29:48 +02:00
parent a2a65ce0f0
commit 630727a76d
2 changed files with 17 additions and 69 deletions
@@ -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 <i>(e.g. Service Product (Prepaid Hours))</i>'),
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',
@@ -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.