From d59830d864e78fb289ff6d3d0109fd477cda2309 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Warnon?= Date: Fri, 25 Jan 2019 14:19:51 +0000 Subject: [PATCH] [IMP] *_product_configurator: improve optional products naming Task #1891970 Purpose ======= The name of the optional products displayed in the modal now change dynamically based on the selected variants configuration. You do not have to wait until the product is in the cart to see the full name anymore. Ex: Conference Chair -> Conference Chair (Steel) --- .../static/src/js/product_configurator_modal.js | 11 ----------- addons/sale_product_configurator/views/templates.xml | 3 +-- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/addons/sale_product_configurator/static/src/js/product_configurator_modal.js b/addons/sale_product_configurator/static/src/js/product_configurator_modal.js index 25835e1c539..da3ac1d8494 100644 --- a/addons/sale_product_configurator/static/src/js/product_configurator_modal.js +++ b/addons/sale_product_configurator/static/src/js/product_configurator_modal.js @@ -6,7 +6,6 @@ var Dialog = require('web.Dialog'); var ServicesMixin = require('web.ServicesMixin'); var VariantMixin = require('sale.VariantMixin'); -var productNameMap = {}; var optionalProductsMap = {}; var OptionalProductsModal = Dialog.extend(ServicesMixin, VariantMixin, { @@ -63,7 +62,6 @@ var OptionalProductsModal = Dialog.extend(ServicesMixin, VariantMixin, { this._productImageField = 'image_medium'; // reset any previously populated properties maps - productNameMap = {}; optionalProductsMap = {}; this._opened.then(function () { @@ -303,11 +301,6 @@ var OptionalProductsModal = Dialog.extend(ServicesMixin, VariantMixin, { $parent.find('.td-qty').addClass('text-center'); $parent.find('.td-qty').append($parent.find('.optional_product_quantity')); - // change product name to display_name (containing attribute values) when it's added to cart - // the "simple" name is kept into a map to revert to it if the product is removed from the cart - productNameMap[productTemplateId] = $parent.find(".product-name").html(); - $parent.find(".product-name").html($parent.find(".product_display_name").val()); - var productCustomVariantValues = self.getCustomVariantValues($parent); var noVariantAttributeValues = self.getNoVariantAttributeValues($parent); if (productCustomVariantValues || noVariantAttributeValues) { @@ -408,10 +401,6 @@ var OptionalProductsModal = Dialog.extend(ServicesMixin, VariantMixin, { var $select_options_text = $modal.find('.o_select_options'); $select_options_text.show(); - // revert back to original product name and clean the entry - $parent.find(".product-name").html(productNameMap[productTemplateId]); - delete productNameMap[productTemplateId]; - this._removeOptionOption($modal, productTemplateId); $modal.find('tr:last').after($parent); diff --git a/addons/sale_product_configurator/views/templates.xml b/addons/sale_product_configurator/views/templates.xml index 092471a3820..ba03bbb30d1 100644 --- a/addons/sale_product_configurator/views/templates.xml +++ b/addons/sale_product_configurator/views/templates.xml @@ -165,13 +165,12 @@ - Product Image Product Image
- +