[FIX] point_of_sale: add product attribute with multi selection

Current behavior:
When adding a product with a multi selection attribute, the attribute is
not displayed in the product configurator popup. This only happens when
opening it on a mobile device.

Steps to reproduce:
- Add a product with a multi selection attribute
- Open PoS
- Add the product to the order
- The attribute is not shown on the product configurator popup

opw-3711164

closes odoo/odoo#154893

Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
This commit is contained in:
roen-odoo
2024-03-01 13:48:17 +00:00
parent 7201ed9d6d
commit 0462ab901f
4 changed files with 56 additions and 0 deletions
@@ -165,6 +165,7 @@
<RadioProductAttribute t-if="attribute.display_type === 'radio' or attribute.display_type === 'pills'" attribute="attribute"/>
<SelectProductAttribute t-elif="attribute.display_type === 'select'" attribute="attribute"/>
<ColorProductAttribute t-elif="attribute.display_type === 'color'" attribute="attribute"/>
<MultiProductAttribute t-elif="attribute.display_type === 'multi'" attribute="attribute"/>
</div>
</main>
@@ -7,6 +7,7 @@ import * as ReceiptScreen from "@point_of_sale/../tests/tours/helpers/ReceiptScr
import { registry } from "@web/core/registry";
import * as Order from "@point_of_sale/../tests/tours/helpers/generic_components/OrderWidgetMethods";
import { inLeftSide, scan_barcode } from "@point_of_sale/../tests/tours/helpers/utils";
import * as ProductConfiguratorPopup from "@point_of_sale/../tests/tours/helpers/ProductConfiguratorTourMethods";
registry.category("web_tour.tours").add("ProductScreenTour", {
test: true,
@@ -202,3 +203,17 @@ registry.category("web_tour.tours").add("limitedProductPricelistLoading", {
Chrome.endTour(),
].flat(),
});
registry.category("web_tour.tours").add("MultiProductOptionsTour", {
test: true,
steps: () =>
[
ProductScreen.confirmOpeningPopup(),
ProductScreen.clickDisplayedProduct("Product A"),
ProductConfiguratorPopup.isOptionShown("Value 1"),
ProductConfiguratorPopup.isOptionShown("Value 2"),
Chrome.endTour(),
].flat(),
});
@@ -60,3 +60,13 @@ export function isShown() {
},
];
}
export function isOptionShown(option) {
return [
{
content: `option ${option} is shown`,
trigger: `.form-check-label:contains('${option}')`,
run: () => {},
},
];
}
@@ -1108,6 +1108,36 @@ class TestUi(TestPointOfSaleHttpCommon):
self.main_pos_config.open_ui()
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'limitedProductPricelistLoading', login="accountman")
def test_multi_product_options(self):
product_a = self.env['product.product'].create({
'name': 'Product A',
'available_in_pos': True,
'list_price': 10,
'taxes_id': False,
})
chair_multi_attribute = self.env['product.attribute'].create({
'name': 'Multi',
'display_type': 'multi',
'create_variant': 'no_variant',
})
chair_multi_value_1 = self.env['product.attribute.value'].create({
'name': 'Value 1',
'attribute_id': chair_multi_attribute.id,
})
chair_multi_value_2 = self.env['product.attribute.value'].create({
'name': 'Value 2',
'attribute_id': chair_multi_attribute.id,
})
self.chair_multi_line = self.env['product.template.attribute.line'].create({
'product_tmpl_id': product_a.product_tmpl_id.id,
'attribute_id': chair_multi_attribute.id,
'value_ids': [(6, 0, [chair_multi_value_1.id, chair_multi_value_2.id])]
})
self.main_pos_config.with_user(self.pos_user).open_ui()
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'MultiProductOptionsTour', login="pos_user")
# This class just runs the same tests as above but with mobile emulation
class MobileTestUi(TestUi):
browser_size = '375x667'