The Materiales model is Acrylitec’s source of truth for your physical acrylic sheet inventory. Each record describes a specific sheet by its dimensions and tracks how many units are currently in stock alongside the minimum level below which the business needs to reorder. Because every POS sale references a material and decrements its stock automatically, the inventory stays in sync with the shop floor without requiring manual counts after every order.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/YonAnn99/Acrylitec/llms.txt
Use this file to discover all available pages before exploring further.
Material Fields
The following fields are defined on theMateriales model:
| Field | Type | Description |
|---|---|---|
descripcion | CharField (max 100) | Material name or description, e.g. Acrílico 3mm transparente |
largo | DecimalField | Sheet length in centimetres |
ancho | DecimalField | Sheet width in centimetres |
stock_actual | IntegerField | Current number of units available in the warehouse |
stock_minimo | IntegerField | Minimum acceptable stock level; alerts fire when stock_actual <= stock_minimo |
Searching Materials
The material list atGET /materiales/ accepts an optional q query parameter. When provided, the view filters the queryset by the descripcion field using a case-insensitive icontains lookup:
GET /materiales/?q=3mm returns every material whose description contains “3mm” (case-insensitive), such as Acrílico 3mm transparente or 3mm negro. To clear the filter and see all materials, navigate to /materiales/ without the q parameter.
Low-Stock Alerts
Thelista_materiales view calculates materiales_bajos — a count of all materials whose stock_actual is at or below their stock_minimo:
/materiales/. Individual rows in the table are highlighted in amber and marked with a ⚠️ Stock bajo badge, or in red with a Sin stock badge if stock_actual is zero.
Creating a Material
Open the creation form
Navigate to
/materiales/nuevo/. The form is rendered by the crear_material view.Fill in the sheet details
The form requires the following fields, which map directly to model fields:
Note that the HTML input for current stock uses the name
| Form field | Model field | Notes |
|---|---|---|
descripcion | descripcion | Text description of the sheet |
largo | largo | Length in cm (decimal accepted) |
ancho | ancho | Width in cm (decimal accepted) |
stock | stock_actual | Starting stock count |
stock_minimo | stock_minimo | Alert threshold |
stock (not stock_actual). The view maps it correctly: stock_actual=request.POST.get('stock').Deleting a Material
Deletion follows a two-step confirmation flow handled by theeliminar_material view at /materiales/eliminar/<id>/:
Visit the confirmation page (GET)
Navigate to
GET /materiales/eliminar/<id>/. The view counts how many Cotizaciones and DetalleVenta rows reference this material and renders a confirmation page showing those counts.Automatic Stock Deduction
When a new POS order is confirmed atPOST /pedidos/nuevo/, the nuevo_pedido view iterates over every item in the cart. For each DetalleVenta item it creates, it decrements the corresponding material’s stock_actual by the ordered cantidad, flooring at zero to prevent negative stock:
update_fields=['stock_actual'] ensures only the stock column is written, avoiding accidental overwrites of other fields.
Low-Stock Alerts on Sale
After all cart items are processed, the POS endpoint collects any material that has fallen to or below its minimum threshold and returns them in thealertas_stock array of the JSON response:
alertas_stock array means all materials remain above their minimum thresholds.