[FIX] website_sale_comparison: Compare product with single variant

What are the steps to reproduce your issue ?

    1. Install "website_sale_comparison"
    2. Create a product with only one variant with one attribut
    3. Click on "Go to website" smart button
    4. Enable "Customize/List View Variant"
    5. Click on "Compare" button

What is currently happening ?

    Nothing

What are you expecting to happen ?

    Add product to the comparison list

Why is this happening ?

    Because the product has just one variant and attribut so odoo don't
    display it on the product page. The system cannot find the ids as
    they are not on the page

How to fix the bug ?

    Specify the product id in this case

opw-2377711
https://www.odoo.com/web#id=2377711&action=4043&model=project.task&view_type=form&cids=1&menu_id=4720

closes odoo/odoo#62424

X-original-commit: ea1f23ea75c457c615968f3cb632fd7db7d39d6e
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Signed-off-by: Achraf <abz-odoo@users.noreply.github.com>
This commit is contained in:
Achraf (abz)
2020-11-27 14:40:06 +00:00
parent f991436ee2
commit cd9b3c69ac
@@ -105,7 +105,7 @@ var ProductComparison = publicWidget.Widget.extend(VariantMixin, {
$elem.closest('form').find('.product_template_id').val(),
false
).then(function (productId) {
productId = parseInt(productId, 10);
productId = parseInt(productId, 10) || parseInt($elem.data('product-product-id'), 10);
if (!productId) {
return;
}