[FIX] website_sale_stock: product availability

- Install eCommerce, Inventory,
- Go to website setting and set availability of products as a "Show
  inventory on website and prevent sales if not enough stock"
- Create new service type product, and publish it
- Go to shop

The button Add to cart is disabled.

Apply this option to stockable products only.

opw-1931638

closes odoo/odoo#30444
This commit is contained in:
Nicolas Martinelli
2019-01-22 15:41:13 +00:00
parent 3eeb77414b
commit 2cfbb8594b
@@ -45,7 +45,7 @@ ProductConfiguratorMixin._onChangeCombinationStock = function (ev, $parent, comb
var qty = $parent.find('input[name="add_qty"]').val();
$parent.find('#add_to_cart').removeClass('out_of_stock');
if (_.contains(['always', 'threshold'], combination.inventory_availability)) {
if (combination.product_type === 'product' && _.contains(['always', 'threshold'], combination.inventory_availability)) {
combination.virtual_available -= parseInt(combination.cart_qty);
if (combination.virtual_available < 0) {
combination.virtual_available = 0;
@@ -88,4 +88,4 @@ sAnimations.registry.WebsiteSale.include({
return ProductConfiguratorMixin;
});
});