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:
parent
539cd5cccd
commit
2a005a9d5a
7 changed files with 132 additions and 6 deletions
|
|
@ -27,6 +27,14 @@ class ResConfigSettings(models.TransientModel):
|
|||
help="Number of products to load per page in group order shop. Minimum 5, Maximum 100.",
|
||||
)
|
||||
|
||||
low_stock_threshold = fields.Float(
|
||||
string="Low Stock Threshold",
|
||||
config_parameter="website_sale_aplicoop.low_stock_threshold",
|
||||
default=5.0,
|
||||
help="Products with stock below or equal to this value will show 'Low Stock' ribbon. "
|
||||
"Products with stock = 0 will show 'Out of Stock' ribbon and cannot be added to cart.",
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def _get_products_per_page_selection(records):
|
||||
"""Return default page sizes."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue