feat(website_sale_aplicoop): sistema de ribbons basado en stock

- Añadidos ribbons 'Sin Stock' (rojo) y 'Pocas Existencias' (amarillo)
- Nuevo campo configurable: umbral de stock bajo (default: 5.0)
- Campos computed en product.product:
  * is_out_of_stock: True cuando qty_available <= 0
  * is_low_stock: True cuando 0 < qty_available <= threshold
  * dynamic_ribbon_id: ribbon automático según nivel de stock
- Ordenamiento mejorado: productos con stock primero, sin stock al final
- Template actualizado:
  * Muestra ribbon de stock en tarjeta de producto
  * Deshabilita botón add-to-cart cuando producto sin stock
  * Cambia icono a 'fa-ban' en productos sin stock
- Vista de configuración: campo 'Low Stock Threshold' en Settings > Shop Performance
- Solo aplica a productos type='consu' (almacenables)
- Tests: 112 pasados, 0 fallos
This commit is contained in:
snt 2026-02-25 19:48:39 +01:00
parent 539cd5cccd
commit 2a005a9d5a
7 changed files with 132 additions and 6 deletions

View file

@ -53,6 +53,20 @@
</div>
</div>
</div>
<div class="col-12 col-lg-6 o_setting_box">
<div class="o_setting_left_pane"/>
<div class="o_setting_right_pane">
<label for="low_stock_threshold" string="Low Stock Threshold"/>
<div class="text-muted">
Products with stock ≤ this value show "Low Stock" ribbon. Stock = 0 shows "Out of Stock" ribbon.
</div>
<div class="content-group">
<div class="mt16">
<field name="low_stock_threshold" class="oe_inline"/>
</div>
</div>
</div>
</div>
</div>
</xpath>
</field>