[FIX] website_sale_stock_options: set max qty only if inventory_availability is always/threshold

Before this commit, the input quantity would have a max qty attribute set even
if the product was not set as check inventory (inventory_availability set to
always or threshold).
  - Set inventory_availability to never in a product
  - Order more than 1 quantity
  - The sale option popup will set input quantity to 1

Now, it will check and force max quantity only for product with threshold or
always as inventory_availability.
This commit is contained in:
rde
2017-10-20 17:37:22 +02:00
parent c912596deb
commit 3351d2acc0
@@ -3,7 +3,7 @@
<!-- Shopping Cart Lines -->
<template id="website_sale_stock_modal" inherit_id="website_sale_options.modal" name="Stocks Modal">
<xpath expr="//input[@type='text'][hasclass('quantity')]" position="attributes">
<attribute name='t-att-data-max'>max(product.sudo().virtual_available - product.cart_qty, 1)</attribute>
<attribute name='t-att-data-max'>max(product.sudo().virtual_available - product.cart_qty, 1) if product.type == "product" and product.inventory_availability in ["always", "threshold"] else None</attribute>
</xpath>
<xpath expr="//div[hasclass('css_quantity')]" position="after">
<div class='availability_messages'/>