[REV] website_sale: open configurator with only no variants attributes
This reverts commit 436c1c6.
The commit was fixing an issue where the product configurator dialog
would not be shown for custom attribute, no variant, and dynamic
attribute using the quick buy add button on the '/shop' page.
The commit introduces an undesirable behavior: the product configurator
would always be open if customers choose none of the multi-checkbox
options.
closes odoo/odoo#161144
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
This commit is contained in:
committed by
Victor Feyens
parent
51b0834044
commit
b7d1b26b97
@@ -22,7 +22,7 @@ class WebsiteSaleProductConfiguratorController(Controller):
|
||||
|
||||
already_configured = bool(combination)
|
||||
if not force_dialog and not has_optional_products and (
|
||||
not product.has_configurable_attributes or already_configured
|
||||
product.product_variant_count <= 1 or already_configured
|
||||
):
|
||||
# The modal is not shown if there are no optional products and
|
||||
# the main product either has no variants or is already configured
|
||||
|
||||
-29
@@ -1,29 +0,0 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { registry } from "@web/core/registry";
|
||||
import tourUtils from "@website_sale/js/tours/tour_utils";
|
||||
|
||||
registry.category("web_tour.tours").add('tour_configurator_quick_add_only_no_dynamic_attributes', {
|
||||
test: true,
|
||||
url: '/shop',
|
||||
steps: () => [
|
||||
...tourUtils.searchProduct("Short (TEST)"),
|
||||
{
|
||||
content: "open configurator",
|
||||
trigger: '.oe_product:has(a:contains("Short (TEST)")) div.o_wsale_product_btn a',
|
||||
},
|
||||
{
|
||||
content: "select M dynamic attribute",
|
||||
trigger: '.oe_advanced_configurator_modal label:contains("M dynamic") input',
|
||||
},
|
||||
{
|
||||
content: "Go through the modal window of the product configurator",
|
||||
extra_trigger: '.oe_advanced_configurator_modal strong:contains("Short (TEST) (M dynamic)")',
|
||||
trigger: 'button span:contains(Proceed to Checkout)',
|
||||
},
|
||||
tourUtils.assertCartContains({
|
||||
productName: 'Short (TEST) (M dynamic)',
|
||||
backend: false,
|
||||
}),
|
||||
]
|
||||
});
|
||||
-29
@@ -1,29 +0,0 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { registry } from "@web/core/registry";
|
||||
import tourUtils from "@website_sale/js/tours/tour_utils";
|
||||
|
||||
registry.category("web_tour.tours").add('tour_configurator_quick_add_only_no_variant_attributes', {
|
||||
test: true,
|
||||
url: '/shop',
|
||||
steps: () => [
|
||||
...tourUtils.searchProduct("Short (TEST)"),
|
||||
{
|
||||
content: "open configurator",
|
||||
trigger: '.oe_product:has(a:contains("Short (TEST)")) div.o_wsale_product_btn a',
|
||||
},
|
||||
{
|
||||
content: "select M dynamic attribute",
|
||||
trigger: '.oe_advanced_configurator_modal label:contains("M never") input',
|
||||
},
|
||||
{
|
||||
content: "Go through the modal window of the product configurator",
|
||||
trigger: 'button span:contains(Continue Shopping)',
|
||||
},
|
||||
{
|
||||
content: "check that the novariants/custom attributes are displayed.",
|
||||
trigger: '.toast-body span.text-muted.small:contains("Never attribute size: M never")',
|
||||
isCheck: true,
|
||||
},
|
||||
]
|
||||
});
|
||||
-29
@@ -1,29 +0,0 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { registry } from "@web/core/registry";
|
||||
import tourUtils from "@website_sale/js/tours/tour_utils";
|
||||
|
||||
registry.category("web_tour.tours").add('tour_configurator_quick_add_single_custom_attribute', {
|
||||
test: true,
|
||||
url: '/shop',
|
||||
steps: () => [
|
||||
...tourUtils.searchProduct("Short (TEST)"),
|
||||
{
|
||||
content: "open configurator",
|
||||
trigger: '.oe_product:has(a:contains("Short (TEST)")) div.o_wsale_product_btn a',
|
||||
},
|
||||
{
|
||||
trigger: 'input.variant_custom_value',
|
||||
run: 'text TEST',
|
||||
},
|
||||
{
|
||||
content: "Go through the modal window of the product configurator",
|
||||
trigger: 'button span:contains(Continue Shopping)',
|
||||
},
|
||||
{
|
||||
content: "check that the novariants/custom attributes are displayed.",
|
||||
trigger: '.toast-body span.text-muted.small:contains("Always attribute size: Yes never custom: TEST")',
|
||||
isCheck: true,
|
||||
},
|
||||
]
|
||||
});
|
||||
@@ -1,6 +1,5 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo.fields import Command
|
||||
from odoo.tests import tagged
|
||||
|
||||
from odoo.addons.base.tests.common import HttpCaseWithUserDemo, HttpCaseWithUserPortal
|
||||
@@ -147,86 +146,3 @@ class TestWebsiteSaleProductConfigurator(TestProductConfiguratorCommon, HttpCase
|
||||
new_sale_order = self.env['sale.order'].search([]) - old_sale_order
|
||||
new_order_line = new_sale_order.order_line
|
||||
self.assertEqual(new_order_line.name, 'Short (TEST) (M always, M dynamic)\n\nNever attribute size: M never\nNever attribute size custom: Yes never custom: TEST')
|
||||
|
||||
def test_03_only_no_variant_attributes(self):
|
||||
""" Test that the configurator dialog is opened when a product with only no variant
|
||||
attributes is added from the /shop page.
|
||||
"""
|
||||
self.env.ref('website_sale.products_add_to_cart').active = True # Enable quick add button
|
||||
no_variant_attribute = self.env['product.attribute'].create({
|
||||
'name': 'Never attribute size',
|
||||
'display_type': 'radio',
|
||||
'create_variant': 'no_variant',
|
||||
'value_ids': [
|
||||
Command.create({'name': 'S never'}),
|
||||
Command.create({'name': 'M never'}),
|
||||
]
|
||||
})
|
||||
self.env['product.template'].create({
|
||||
'name': 'Short (TEST)',
|
||||
'website_published': True,
|
||||
'attribute_line_ids': [
|
||||
Command.create({
|
||||
'attribute_id': no_variant_attribute.id,
|
||||
'value_ids': [Command.set(no_variant_attribute.value_ids.ids)],
|
||||
})
|
||||
],
|
||||
})
|
||||
|
||||
self.start_tour("/shop", 'tour_configurator_quick_add_only_no_variant_attributes')
|
||||
|
||||
def test_04_only_dynamic_attributes(self):
|
||||
""" Test that the configurator dialog is opened when a product with only dynamic
|
||||
attributes is added from the /shop page.
|
||||
"""
|
||||
self.env.ref('website_sale.products_add_to_cart').active = True # Enable quick add button
|
||||
dynamic_attribute = self.env['product.attribute'].create({
|
||||
'name': 'Dynamic attribute size',
|
||||
'display_type': 'radio',
|
||||
'create_variant': 'dynamic',
|
||||
'value_ids': [
|
||||
Command.create({'name': 'S dynamic'}),
|
||||
Command.create({'name': 'M dynamic'}),
|
||||
]
|
||||
})
|
||||
self.env['product.template'].create({
|
||||
'name': 'Short (TEST)',
|
||||
'website_published': True,
|
||||
'attribute_line_ids': [
|
||||
Command.create({
|
||||
'attribute_id': dynamic_attribute.id,
|
||||
'value_ids': [Command.set(dynamic_attribute.value_ids.ids)],
|
||||
})
|
||||
],
|
||||
})
|
||||
|
||||
self.start_tour("/shop", 'tour_configurator_quick_add_only_no_dynamic_attributes')
|
||||
|
||||
def test_05_single_custom_attribute(self):
|
||||
""" Test that the configurator dialog is opened when a product with a single custom
|
||||
attributes is added from the /shop page.
|
||||
"""
|
||||
self.env.ref('website_sale.products_add_to_cart').active = True # Enable quick add button
|
||||
attribute = self.env['product.attribute'].create({
|
||||
'name': 'Always attribute size',
|
||||
'display_type': 'radio',
|
||||
'create_variant': 'always',
|
||||
'value_ids': [
|
||||
Command.create({
|
||||
'name': 'Yes never custom',
|
||||
'is_custom': True,
|
||||
}),
|
||||
]
|
||||
})
|
||||
self.env['product.template'].create({
|
||||
'name': 'Short (TEST)',
|
||||
'website_published': True,
|
||||
'attribute_line_ids': [
|
||||
Command.create({
|
||||
'attribute_id': attribute.id,
|
||||
'value_ids': [Command.set(attribute.value_ids.ids)],
|
||||
})
|
||||
],
|
||||
})
|
||||
|
||||
self.start_tour("/shop", 'tour_configurator_quick_add_single_custom_attribute')
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
<t t-if="product and not combination">
|
||||
<t t-set="combination" t-value="product_template._get_first_possible_combination()"/>
|
||||
</t>
|
||||
<t t-if="not already_configured" t-call="website_sale.variants">
|
||||
<t t-if="combination and not already_configured" t-call="website_sale.variants">
|
||||
<t t-set="ul_class" t-valuef="flex-column" />
|
||||
<t t-set="product" t-value="product_template"/>
|
||||
</t>
|
||||
|
||||
Reference in New Issue
Block a user