From a33028095fc7fa4ef838de405696ef19caa89ca6 Mon Sep 17 00:00:00 2001 From: "Julien Carion (juca)" Date: Fri, 24 Nov 2023 13:50:32 +0000 Subject: [PATCH] [FIX] sale_product_configurator, web: fix warning This commit fixes an issue with the product configurator where if a subproduct contains an on sale warning, the subproduct won't be added to the quotation when the main product is added. In order to fix this issue, it was needed to provide a way for the allowWarning option to be passed from the addNew method of the basic_relational_model to the _applyX2ManyChange method of the basic_model. This is done by propagating the option through the command until it reaches the basic_model. Since the issue is no longer present in 16.3, this forward port only adds the test. opw-3462462 closes odoo/odoo#145404 X-original-commit: 2204ced3e24773c34e9356fd5b1d658f8b330dd1 Signed-off-by: Aaron Bohy (aab) Signed-off-by: Julien Carion (juca) --- .../tests/tours/product_configurator_optional_products_ui.js | 3 +++ .../tests/test_sale_product_configurator.py | 2 ++ 2 files changed, 5 insertions(+) diff --git a/addons/test_sale_product_configurators/static/tests/tours/product_configurator_optional_products_ui.js b/addons/test_sale_product_configurators/static/tests/tours/product_configurator_optional_products_ui.js index 0b1aae94515..c8ecd274c4e 100644 --- a/addons/test_sale_product_configurators/static/tests/tours/product_configurator_optional_products_ui.js +++ b/addons/test_sale_product_configurators/static/tests/tours/product_configurator_optional_products_ui.js @@ -38,6 +38,9 @@ registry.category("web_tour.tours").add('sale_product_configurator_optional_prod trigger: 'tr:has(div[name="o_sale_product_configurator_name"]:contains("Conference Chair")) button:has(i.fa-plus)', }, { trigger: 'button:contains(Confirm)', +}, { + trigger: '.o-default-button', + extra_trigger: '.modal-title:contains(Warning for Conference Chair (TEST))', }, { trigger: 'tr:has(td.o_data_cell:contains("Customizable Desk")) td.o_data_cell:contains("2.0")', isCheck: true, diff --git a/addons/test_sale_product_configurators/tests/test_sale_product_configurator.py b/addons/test_sale_product_configurators/tests/test_sale_product_configurator.py index 7865ac6479b..57dfa346df7 100644 --- a/addons/test_sale_product_configurators/tests/test_sale_product_configurator.py +++ b/addons/test_sale_product_configurators/tests/test_sale_product_configurator.py @@ -176,6 +176,8 @@ class TestProductConfiguratorUi(HttpCase, TestProductConfiguratorCommon): (6, 0, [office_chair.product_tmpl_id.id, self.product_product_conf_chair.id]) ] }) + self.product_product_conf_chair.sale_line_warn = 'warning' + self.product_product_conf_chair.sale_line_warn_msg = 'sold' self.product_product_custo_desk.optional_product_ids = [ (4, self.product_product_conf_chair.id) ]