Actions36
- 📦 Producto Actions
- 📊 Stock Actions
- 📋 Movimiento Actions
- 🛒 Venta Actions
- 📥 Recepción Actions
- 📥 Borrador Recepción (n8n) Actions
- 📝 Borrador (texto) Actions
- 🤖 Propuesta IA Actions
- 🏭 Bodega Actions
- 👤 Cliente Actions
- 📚 Catálogo Actions
- 📰 Reportes (legacy) Actions
🛒 Venta → Crear Venta
AI-generatedSummary
Creates a sales order in the Ditextil inventory system by POSTing to /api/orders/sales with a customer reference and a JSON array of line items.
Inputs
- clientId — Existing client picked from a dropdown loaded from /api/clients. Sent as client_id if it converts to a non-zero number; otherwise omitted.
- partyName — Free-text customer name, sent as client_name. Omitted if empty. It can be used with or instead of the client ID.
- itemsJson (required) — JSON array of order lines, sent as items. Default is [{"product_id": 15, "quantity": 1}]. A string is parsed as JSON, and invalid JSON throws 'Líneas JSON debe ser JSON válido'. An expression that resolves to an object or array is passed through as is. The node does not check the line fields. The default shows product_id and quantity.
Output shape
The Ditextil API's JSON response for the created sale order. Each response object becomes an output item, and an array response becomes one item per element. The node does not describe the response fields.
The request is made once per input item, and the body always includes source: 'n8n'. Empty fields are dropped from the body. If a request fails and 'Continue On Fail' is enabled, the output item is {error: message}. Otherwise the node throws. Requests use the ditextilApi credential and its baseUrl.
Examples
Example 1: Register a sale for an existing client with two products
Select ID Cliente from the dropdown. Set Líneas JSON to [{"product_id":15,"quantity":2},{"product_id":22,"quantity":1}].
Example 2: Create a sale for a walk-in customer by name
Leave ID Cliente empty. Set Cliente / Nombre to 'Juan Pérez'. Set Líneas JSON to [{"product_id":15,"quantity":1}].
Example 3: Build lines dynamically from an earlier node
Set Líneas JSON to an expression such as {{ JSON.stringify($json.lines) }}, with Cliente / Nombre mapped from $json.customer.