From 573c689a9b3c50d5a9e7222f2385c0484cd2626e Mon Sep 17 00:00:00 2001 From: Valentin Chevalier Date: Thu, 14 Sep 2023 17:09:20 +0200 Subject: [PATCH] [FIX] sale_product_configurator: exclude product deleted Before this commit, the product configurator did not handle a deleted product variant if a product variant had instantly create attribute, but was deleted from the database. Now, the product configurator will consider a combination `archived` if the product variant doesn't exist (based on its id) and its create_mode is `always`. opw-3487571 closes odoo/odoo#139986 X-original-commit: 7abeb13ae53962694ec7fb02de133fc3d7a82908 Signed-off-by: Valentin Chevalier --- .../product_configurator_dialog.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/sale_product_configurator/static/src/js/product_configurator_dialog/product_configurator_dialog.js b/addons/sale_product_configurator/static/src/js/product_configurator_dialog/product_configurator_dialog.js index 24f61a22085..088ee25176f 100644 --- a/addons/sale_product_configurator/static/src/js/product_configurator_dialog/product_configurator_dialog.js +++ b/addons/sale_product_configurator/static/src/js/product_configurator_dialog/product_configurator_dialog.js @@ -234,6 +234,13 @@ export class ProductConfiguratorDialog extends Component { if (this._isPossibleCombination(product)) { const updatedValues = await this._updateCombination(product, product.quantity); Object.assign(product, updatedValues); + // When a combination should exist but was deleted from the database, it should not be + // selectable and considered as an exclusion. + if (!product.id && product.attribute_lines.every(ptal => ptal.create_variant === "always")) { + const combination = this._getCombination(product); + product.archived_combinations = product.archived_combinations.concat([combination]); + this._checkExclusions(product); + } } }