[FIX] sale_product_configurator: Track custom values when adding an item to cart from the website

Steps to reproduce the issue:
- Go to the website shop
- Select a product which allows custom features (eg. Customizable desk)
- Select custom and enter a value
- Add to cart

Issue:
Neither the modal preview nor the cart of the added item doesn't show the custom value, also it
doesn't appear in the created sale order

Cause:
The optional sale_product_configurator module hasn't implemented it

opw-3052987

closes odoo/odoo#107335

X-original-commit: 954653062ad6060babb77a712b269337b479fa65
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commit is contained in:
Eteil Djoumatchoua (etdj)
2022-12-08 13:37:54 +01:00
parent 40d86ef921
commit bb12e9632c
3 changed files with 12 additions and 1 deletions
@@ -79,7 +79,8 @@ class ProductConfiguratorController(http.Controller):
'pricelist': pricelist,
'handle_stock': handle_stock,
'already_configured': kw.get("already_configured", False),
'mode': kw.get('mode', 'add')
'mode': kw.get('mode', 'add'),
'product_custom_attribute_values': kw.get('product_custom_attribute_values', None)
})
def _get_pricelist(self, pricelist_id, pricelist_fallback=False):
@@ -79,6 +79,7 @@ export const OptionalProductsModal = Dialog.extend(ServicesMixin, VariantMixin,
mode: self.mode,
product_id: self.rootProduct.product_id,
variant_values: self.rootProduct.variant_values,
product_custom_attribute_values: self.rootProduct.product_custom_attribute_values,
pricelist_id: self.pricelistId || false,
add_qty: self.rootProduct.quantity,
force_dialog: self.forceDialog,
@@ -104,6 +104,15 @@
<div class="text-muted small">
<div t-field="product.description_sale"/>
<div class="js_attributes"/>
<div t-if="product_custom_attribute_values">
<t t-foreach="product_custom_attribute_values" t-as="custom_value">
<span t-esc="custom_value.get('attribute_value_name', None)"/>: <span t-esc="custom_value['custom_value']"/>
<input type="hidden" class="variant_custom_value"
t-att-data-custom_product_template_attribute_value_id="custom_value['custom_product_template_attribute_value_id']"
t-att-data-attribute_value_name="custom_value.get('attribute_value_name', None)"
t-att-value="custom_value['custom_value']"/>
</t>
</div>
</div>
<div>
<t t-if="product.product_tmpl_id and not combination">