[FIX] website_sale_comparison : error when entering number of item in product

Steps to reproduce:
- Install eCommerce with product comparator
- Open the product in </shop>
- Change the product quantity
- Click on the <Enter> key

Current behavior:
En error message appears.

Expected behavior:
No error message appears.

Explanation:
The productComparison widget overrided the submit with a selector
that was not specific to the comparison so its _onFormSubmit function
could be called from other pages creating errors. To solve the issue
we add a specific class to the form and to the selector.

opw-2936994

closes odoo/odoo#97221

X-original-commit: 600e6f3c7ab10b97684fa4268ce5501a3b61e628
Signed-off-by: William Braeckman (wbr) <wbr@odoo.com>
This commit is contained in:
mafo-odoo
2022-08-01 19:37:17 +02:00
committed by William Braeckman
parent 6c7f178bdc
commit bccd2f3f09
2 changed files with 2 additions and 2 deletions
@@ -265,7 +265,7 @@ publicWidget.registry.ProductComparison = publicWidget.Widget.extend(cartHandler
events: {
'click .o_add_compare, .o_add_compare_dyn': '_onClickAddCompare',
'click #o_comparelist_table tr': '_onClickComparelistTr',
'submit form[action="/shop/cart/update"]': '_onFormSubmit',
'submit .o_add_cart_form_compare': '_onFormSubmit',
},
/**
@@ -110,7 +110,7 @@
</small>
</span>
<form action="/shop/cart/update" method="post" class="text-center">
<form action="/shop/cart/update" method="post" class="text-center o_add_cart_form_compare">
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
<input name="product_id" t-att-value="product.id" type="hidden"
t-att-data-product-tracking-info="json.dumps(request.env['product.template'].get_google_analytics_data(combination_info))"/>