[FIX] website_sale_aplicoop: block out-of-stock add

This commit is contained in:
snt 2026-03-03 15:30:43 +01:00
parent 9bd48654fd
commit 33c148e6a1
3 changed files with 32 additions and 3 deletions

View file

@ -666,7 +666,16 @@
<t t-set="safe_uom_category" t-value="product_display_info.get(product.id, {}).get('safe_uom_category', '')" />
<t t-set="quantity_step" t-value="product_display_info.get(product.id, {}).get('quantity_step', 1)" />
<t t-set="order_id_safe" t-value="group_order.id if group_order else ''" />
<form class="add-to-cart-form" t-attf-data-order-id="{{ order_id_safe }}" t-attf-data-product-id="{{ product.id }}" t-attf-data-product-name="{{ product.name }}" t-attf-data-product-price="{{ display_price }}" t-attf-data-uom-category="{{ safe_uom_category }}" t-attf-data-quantity-step="{{ quantity_step }}">
<form
class="add-to-cart-form"
t-attf-data-order-id="{{ order_id_safe }}"
t-attf-data-product-id="{{ product.id }}"
t-attf-data-product-name="{{ product.name }}"
t-attf-data-product-price="{{ display_price }}"
t-attf-data-uom-category="{{ safe_uom_category }}"
t-attf-data-quantity-step="{{ quantity_step }}"
t-att-data-out-of-stock="'true' if product.is_out_of_stock else 'false'"
>
<div class="qty-control">
<label t-attf-for="qty_{{ product.id }}" class="sr-only">Quantity of <t t-esc="product.name" />
</label>
@ -677,8 +686,14 @@
<button class="qty-increase" type="button" t-attf-data-product-id="{{ product.id }}" aria-label="Increase quantity">
<i class="fa fa-plus" />
</button>
<button class="add-to-cart-btn" type="button" t-attf-aria-label="{{ 'Add %s to cart' % product.name }}" t-attf-title="{{ 'Add %s to cart' % product.name }}">
<i class="fa fa-shopping-cart" aria-hidden="true" />
<button
class="add-to-cart-btn"
type="button"
t-att-data-out-of-stock="'true' if product.is_out_of_stock else 'false'"
t-attf-aria-label="{{ 'Out of stock' if product.is_out_of_stock else 'Add %s to cart' % product.name }}"
t-attf-title="{{ 'Out of stock' if product.is_out_of_stock else 'Add %s to cart' % product.name }}"
>
<i t-attf-class="fa {{ 'fa-ban text-muted' if product.is_out_of_stock else 'fa-shopping-cart' }}" aria-hidden="true" />
</button>
</div>
</form>