The Clientes model is the central link between every quote and every sale in Acrylitec. EachDocumentation 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.
Cotizacion and Venta record carries a foreign key back to a Clientes row, so accurate client data means accurate reporting, easy order history look-up, and clean invoice generation. Keeping the directory up to date ensures that staff can find the right customer in seconds whether they are opening the quoting form or ringing up a walk-in order at the POS screen.
Client Fields
Every client record stores the following information, drawn directly from theClientes model:
| Field | Type | Description |
|---|---|---|
nombre | CharField (max 100) | Customer or company name |
telefono | CharField (max 100) | Contact phone number |
email | CharField (max 100) | Email address |
direccion | TextField | Full delivery or billing address |
blank=True, null=True), but nombre is enforced as required when creating clients through the AJAX endpoint (see below).
Searching Clients
The client list view atGET /clientes/ accepts an optional q query parameter. When q is provided, the view filters the full Clientes queryset using Django Q objects across three fields simultaneously — case-insensitively:
GET /clientes/?q=garcia returns every client whose name, phone, or email contains “garcia” (case-insensitive).
To clear the search and see the full directory, navigate to /clientes/ without the q parameter or click the Limpiar button in the search bar.
Creating a Client
There are two ways to add a new client, depending on your current workflow:Via the standard form
Navigate to
/clientes/nuevo/. Fill in the name, phone, email, and address, then click Guardar Cliente en Base de Datos. The form submits a standard POST request and redirects you back to /clientes/ on success.The nombre field is marked required in the HTML form, so the browser will block submission if it is left blank.Inline from the POS screen (AJAX)
When creating a new order at
/pedidos/nuevo/, you can register a brand-new client without leaving the screen. Click the Nuevo Cliente button in the POS modal. The interface sends a POST request to the AJAX endpoint /ajax/crear-cliente/ and automatically selects the newly created client in the order form.See the AJAX Quick-Create section below for the exact payload and response format.AJAX Quick-Create
The endpointPOST /ajax/crear-cliente/ accepts a JSON body and returns the new client’s database ID so the POS screen can immediately populate its client selector.
Request payload:
crear_cliente_ajax in views.py and is wired to ajax/crear-cliente/ in urls.py.
nombre is the only required field for AJAX creation. All other fields (telefono, email, direccion) are optional and default to null in the database if omitted. The API returns { "ok": false, "error": "El nombre es obligatorio" } if nombre is missing or an empty string.