Skip to main content

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.

The Clientes model is the central link between every quote and every sale in Acrylitec. Each 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 the Clientes model:
FieldTypeDescription
nombreCharField (max 100)Customer or company name
telefonoCharField (max 100)Contact phone number
emailCharField (max 100)Email address
direccionTextFieldFull delivery or billing address
All four fields are optional at the database level (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 at GET /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:
clientes = Clientes.objects.all()
if query:
    clientes = clientes.filter(
        Q(nombre__icontains=query) |
        Q(telefono__icontains=query) |
        Q(email__icontains=query)
    )
Example: 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:
1

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.
2

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 endpoint POST /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:
{
  "nombre": "María García",
  "telefono": "555-1234",
  "email": "maria@example.com",
  "direccion": "Calle Juárez 10, CDMX"
}
Success response:
{ "ok": true, "id_cliente": 42, "nombre": "María García" }
Error response (missing name):
{ "ok": false, "error": "El nombre es obligatorio" }
The endpoint is implemented in 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.

Build docs developers (and LLMs) love