[FIX] sale_product_conf.: not store PNVAV on SOL if single PAV on PTAL

sale_product_configurator: not store product no variant attribute value
on the sale order line if there is a single product attribute value on
the product template attribute line.

Before this change, product no variant attribute values were not
displayed on the sale order line if there was only one product attribute
variant on the product template attribute line. This behavior was
altered in 7e42f381c3 when product configurators were migrated to Owl.

This commit ensures that when there is a single product attribute
variant on the product template attribute line, product no variant
attribute values are not displayed on the sale order line.

closes odoo/odoo#121265

Signed-off-by: Valentin Chevalier <vcr@odoo.com>
This commit is contained in:
Valentin Chevalier
2023-05-15 16:48:22 +02:00
parent 8a8d4e7c59
commit 9612d36d11
3 changed files with 15 additions and 2 deletions
@@ -400,7 +400,7 @@ export class ProductConfiguratorDialog extends Component {
let noVariantCommands = [{ operation: "DELETE_ALL" }];
const noVariantPTAVIds = product.attribute_lines.filter(
ptal => ptal.create_variant === "no_variant"
ptal => ptal.create_variant === "no_variant" && ptal.attribute_values.length > 1
).map(ptal => { return {id: ptal.selected_attribute_value_id}});
if (noVariantPTAVIds.length) noVariantCommands.push({
operation: "ADD_M2M",
@@ -72,7 +72,7 @@ registry.category("web_tour.tours").add('sale_product_configurator_advanced_tour
}, {
trigger: 'button:contains(Confirm)',
}, {
trigger: 'td.o_data_cell:contains("Customizable Desk (TEST) (Custom, White, PAV9, PAV5, PAV1)")',
trigger: 'td.o_data_cell:contains("Customizable Desk (TEST) (Custom, White, PAV9, PAV5, PAV1)"):not(:contains("PA9: Single PAV"))',
isCheck: true,
}, {
trigger: 'td.o_data_cell:contains("Legs: Custom: Custom 1")',
@@ -72,6 +72,19 @@ class TestProductConfiguratorUi(HttpCase, TestProductConfiguratorCommon):
'attribute_id': product_attribute.id
} for i in range(1, 11) for product_attribute in product_attributes])
product_attribute_no_variant_single_pav = self.env['product.attribute'].create({
'name': 'PA9',
'display_type': 'radio',
'create_variant': 'no_variant'
})
self.env['product.attribute.value'].create({
'name': 'Single PAV',
'attribute_id': product_attribute_no_variant_single_pav.id
})
product_attributes += product_attribute_no_variant_single_pav
product_template = self.product_product_custo_desk
self.env['product.template.attribute.line'].create([{