From fa3d8b82be8157d3f9d3cf85711f9e2aaa61f8c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorem=20Ju=C3=A1rez?= Date: Thu, 3 Sep 2026 00:55:53 -0600 Subject: [PATCH] =?UTF-8?q?Rehaz=20las=20=C3=B3rdenes:=20lista=20con=20fil?= =?UTF-8?q?tros,=20detalle=20y=20reembolso=20por=20pasos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Punto 7 —y último— del rediseño de la caja. El TicketScreen se reviste entero: buscador único («número, folio o cliente», que elige el campo del buscador del core por la forma de lo tecleado), pastillas Activas / Cobradas / Todas, filas con chip de hora, folio, resumen y total, y el detalle en un panel blanco de 428px — el mismo ancho que el ticket y el cobro. «Todas» es la única unión que el core no tenía; lo demás es su getFilteredOrderList con otra ropa. Fuera de maqueta: un paginador chico junto al conteo, porque las cobradas vienen del servidor de a 30. El reembolso se vuelve un paso explícito, como pide la maqueta: botón «Reembolsar» → banner rojo → tocar renglones → confirmar con el total en rojo. La mecánica es TODA del core (getToRefundDetail, onClickRefund y su Numpad con el numberBuffer y el tope de «no más de lo vendido» — ADR-011: lo delicado no se reescribe); el teclado solo se reacomoda a las cuatro columnas de la maqueta (1 2 3 ⌫ / 4 5 6 C / 7 8 9 0) con teclas que el buffer ya entiende. El botón se apaga hasta marcar algo —el atajo del core de «único artículo» lo encendía con $0— y a un reembolso o a una orden ya devuelta entera no se les ofrece reembolsar. El chip de estado de la cabecera usa la MISMA paleta que la lista (cobrada verde, en curso neutro): la corrección que la maqueta trae fechada 2-sep-2026. En la lista, leído de la maqueta corrida en el navegador: solo las órdenes en curso llevan chip y bote de basura. La pantalla de cobro aprende la dirección del dinero: en un reembolso el total grande sale en negativo con «Total a devolver», el paso 1 pregunta «¿Cómo se le devuelve?», las notas dicen «Devuelve $X» y el estado «Falta por devolver / Devolución completa». Co-Authored-By: Claude Fable 5 --- addons/beyond_pos_theme/__manifest__.py | 3 + .../static/src/api_pos/contrato.js | 38 +- .../static/src/cobro/beyond_cobro.js | 41 +- .../static/src/cobro/beyond_cobro.xml | 9 +- .../static/src/ordenes/beyond_ordenes.js | 311 +++++++++ .../static/src/ordenes/beyond_ordenes.xml | 236 +++++++ .../static/src/scss/beyond_ordenes.scss | 652 ++++++++++++++++++ .../static/src/scss/beyond_venta.scss | 55 +- .../tests/test_contrato_pos.py | 3 +- .../tests/test_theme_assets.py | 34 + 10 files changed, 1342 insertions(+), 40 deletions(-) create mode 100644 addons/beyond_pos_theme/static/src/ordenes/beyond_ordenes.js create mode 100644 addons/beyond_pos_theme/static/src/ordenes/beyond_ordenes.xml create mode 100644 addons/beyond_pos_theme/static/src/scss/beyond_ordenes.scss diff --git a/addons/beyond_pos_theme/__manifest__.py b/addons/beyond_pos_theme/__manifest__.py index 26ee1ed..c8a7da1 100644 --- a/addons/beyond_pos_theme/__manifest__.py +++ b/addons/beyond_pos_theme/__manifest__.py @@ -57,6 +57,9 @@ El veredicto del spike está en docs/adr/ADR-001-spike-pos.md. 'beyond_pos_theme/static/src/scss/beyond_cobro.scss', 'beyond_pos_theme/static/src/cobro/beyond_cobro.js', 'beyond_pos_theme/static/src/cobro/beyond_cobro.xml', + 'beyond_pos_theme/static/src/scss/beyond_ordenes.scss', + 'beyond_pos_theme/static/src/ordenes/beyond_ordenes.js', + 'beyond_pos_theme/static/src/ordenes/beyond_ordenes.xml', 'beyond_pos_theme/static/src/product_card/product_card.js', 'beyond_pos_theme/static/src/xml/product_card.xml', 'beyond_pos_theme/static/src/empleados_linea/empleados_linea.js', diff --git a/addons/beyond_pos_theme/static/src/api_pos/contrato.js b/addons/beyond_pos_theme/static/src/api_pos/contrato.js index e19f329..4fa7ba5 100644 --- a/addons/beyond_pos_theme/static/src/api_pos/contrato.js +++ b/addons/beyond_pos_theme/static/src/api_pos/contrato.js @@ -23,10 +23,18 @@ // Campos de los modelos del POS. Se leen y se escriben directamente. export const CAMPOS = { - 'pos.order': ['lines', 'tip_amount', 'is_tipped', 'partner_id'], + // pos_reference y date_order pintan folio y hora en cobro y órdenes. + 'pos.order': [ + 'lines', 'tip_amount', 'is_tipped', 'partner_id', + 'pos_reference', 'date_order', + ], + // price_subtotal / _incl: la parte proporcional de impuestos de un + // reembolso (punto 7) sale de estos dos, no de rehacer sus reglas. + // beyond_empleado_ids es nuestro (beyond_pos): quién atendió la línea. 'pos.order.line': [ 'price_unit', 'qty', 'discount', 'uuid', 'product_id', 'price_type', 'full_product_name', 'refunded_orderline_id', + 'price_subtotal', 'price_subtotal_incl', 'beyond_empleado_ids', ], 'pos.config': ['iface_tipproduct', 'tip_product_id'], // La tarjeta del catálogo (rediseño 2-sep-2026): el chip de categoría y @@ -124,6 +132,34 @@ export const METODOS = { 'onClickBackButton': 'regresar del cobro a la venta', 'orderDone': 'cerrar el ciclo tras el cobro (botón «Nueva orden»)', + // Órdenes, detalle y reembolso (punto 7, rediseño 2-sep-2026). La + // pantalla se reviste entera pero cada mando sigue siendo el del core + // — el reembolso es lo más delicado de la caja y ya está probado por + // Odoo (el criterio del cierre, ADR-011). + 'onClickOrder': 'seleccionar una orden de la lista', + 'onClickOrderline': 'enfocar un renglón del detalle (reembolso)', + 'onFilterSelected': 'cambiar el filtro (activas / cobradas) y traer del servidor', + 'onSearch': 'buscar órdenes con el buscador del core (viaja al servidor)', + 'setOrder': 'cargar una orden abierta en la pantalla de venta', + 'onClickRefund': 'confirmar el reembolso: crea la orden espejo del core', + 'getToRefundDetail': 'la cantidad por devolver de un renglón', + 'getSelectedOrder': 'la orden elegida en la lista', + 'getSelectedOrderlineId': 'qué renglón del detalle está enfocado', + 'getFilteredOrderList': 'la lista ya filtrada y buscada por el core', + 'activeOrderFilter': 'el criterio del core de «orden abierta»', + 'isHighlighted': 'si una orden es la elegida (pinta la fila)', + 'shouldHideDeleteButton': 'cuándo el core esconde el bote de basura', + 'getHasItemsToRefund': 'si hay algo marcado por devolver (apaga el botón)', + 'getTotal': 'el total de una orden como lo pinta el core', + 'getOrderlines': 'los renglones de una orden', + 'getTime': 'la hora de una orden en el formato del locale', + 'getDate': 'la fecha de una orden en el formato del locale', + 'formatProductQty': 'vestir una cantidad como la viste el core', + 'getNbrPages': 'cuántas páginas de cobradas hay (vienen de a 30)', + 'getPageNumber': 'el rótulo «1-30 / 90» del paginador', + 'onNextPage': 'pasar a la página siguiente de cobradas', + 'onPrevPage': 'regresar a la página anterior de cobradas', + // `selector_clientes.js` y `atribucion_obligatoria.js` heredan de // pantallas del POS y llaman a `super`: eso no es una API que se pueda // declarar, es herencia. Si el método desaparece, el `patch` falla al diff --git a/addons/beyond_pos_theme/static/src/cobro/beyond_cobro.js b/addons/beyond_pos_theme/static/src/cobro/beyond_cobro.js index 9ba875f..0d27063 100644 --- a/addons/beyond_pos_theme/static/src/cobro/beyond_cobro.js +++ b/addons/beyond_pos_theme/static/src/cobro/beyond_cobro.js @@ -50,40 +50,56 @@ patch(PaymentScreen.prototype, { ) / 100; }, + /** En un reembolso el total es negativo: la dirección del dinero se + * invierte y «falta» significa falta por DEVOLVER. */ + get beyondSentido() { + return this.beyondTotal < 0 ? -1 : 1; + }, + get beyondFalta() { - return Math.max(0, Math.round((this.beyondTotal - this.beyondPagado) * 100) / 100); + const resta = Math.round((this.beyondTotal - this.beyondPagado) * 100) / 100; + return Math.max(0, this.beyondSentido * resta); }, get beyondCambio() { - return Math.max(0, Math.round((this.beyondPagado - this.beyondTotal) * 100) / 100); + const sobra = Math.round((this.beyondPagado - this.beyondTotal) * 100) / 100; + return Math.max(0, this.beyondSentido * sobra); }, get beyondEstado() { const dinero = (v) => this.env.utils.formatCurrency(v); + const devolucion = this.currentOrder.isRefund; if (this.beyondCambio > 0.004) { return { clase: "beyond_estado_cambio", - etiqueta: _t("Cambio para el cliente"), + etiqueta: devolucion + ? _t("Devuelto de más") : _t("Cambio para el cliente"), monto: dinero(this.beyondCambio) }; } if (this.beyondFalta > 0.004 || !this.paymentLines.length) { return { clase: "beyond_estado_falta", - etiqueta: _t("Falta por cobrar"), + etiqueta: devolucion + ? _t("Falta por devolver") : _t("Falta por cobrar"), monto: dinero(this.beyondFalta) }; } return { clase: "beyond_estado_completo", - etiqueta: _t("Pago completo"), - monto: dinero(this.beyondTotal) }; + etiqueta: devolucion + ? _t("Devolución completa") : _t("Pago completo"), + monto: dinero(Math.abs(this.beyondTotal)) }; }, - /** «$1,090» partido en enteros y centavos para el número grande. */ + /** «$1,090» partido en enteros y centavos para el número grande. + * El signo va aparte: en un reembolso el número grande es negativo. */ get beyondTotalPartes() { - const texto = this.env.utils.formatCurrency(this.beyondTotal); + const texto = this.env.utils.formatCurrency(Math.abs(this.beyondTotal)); const limpio = texto.replace(/[^0-9.,]/g, "").trim(); const punto = limpio.lastIndexOf("."); + const signo = this.beyondTotal < 0 ? "\u2212" : ""; if (punto === -1) { - return { enteros: limpio, centavos: "00" }; + return { signo, enteros: limpio, centavos: "00" }; } - return { enteros: limpio.slice(0, punto), centavos: limpio.slice(punto + 1) }; + return { signo, + enteros: limpio.slice(0, punto), + centavos: limpio.slice(punto + 1) }; }, // ── Los métodos (paso 1) ──────────────────────────────────────────── @@ -115,7 +131,10 @@ patch(PaymentScreen.prototype, { return { texto: _t("%s registrado", dinero(registrado)), activa: true }; } if (this.beyondFalta > 0.004) { - return { texto: _t("Agrega %s", dinero(this.beyondFalta)), activa: false }; + const monto = dinero(this.beyondFalta); + return { texto: this.currentOrder.isRefund + ? _t("Devuelve %s", monto) : _t("Agrega %s", monto), + activa: false }; } return { texto: _t("Agregar otro pago"), activa: false }; }, diff --git a/addons/beyond_pos_theme/static/src/cobro/beyond_cobro.xml b/addons/beyond_pos_theme/static/src/cobro/beyond_cobro.xml index 6a42050..2ae7a96 100644 --- a/addons/beyond_pos_theme/static/src/cobro/beyond_cobro.xml +++ b/addons/beyond_pos_theme/static/src/cobro/beyond_cobro.xml @@ -58,7 +58,8 @@
1 - ¿Cómo paga el cliente? + ¿Cómo se le devuelve? + ¿Cómo paga el cliente? @@ -128,8 +129,12 @@
- Total a cobrar + + Total a devolver + Total a cobrar + + $ . diff --git a/addons/beyond_pos_theme/static/src/ordenes/beyond_ordenes.js b/addons/beyond_pos_theme/static/src/ordenes/beyond_ordenes.js new file mode 100644 index 0000000..506f506 --- /dev/null +++ b/addons/beyond_pos_theme/static/src/ordenes/beyond_ordenes.js @@ -0,0 +1,311 @@ +/* Part of Beyond. Collina Systems proprietary module. */ +import { useState } from "@odoo/owl"; +import { patch } from "@web/core/utils/patch"; +import { TicketScreen } from "@point_of_sale/app/screens/ticket_screen/ticket_screen"; +import { _t } from "@web/core/l10n/translation"; + +import { valorDeLinea } from "../api_pos/contrato"; + +/** + * Órdenes, detalle y reembolso (rediseño 2-sep-2026, punto 7). + * + * La pantalla se viste entera, la lógica sigue siendo del core: filtros, + * búsqueda, selección, borrado y —sobre todo— el reembolso completo + * (getToRefundDetail, onClickRefund y el teclado con su tope de «no más + * de lo vendido») se llaman tal cual. Lo delicado del reembolso ya está + * probado por Odoo; aquí solo cambia la ropa (el mismo criterio que el + * cierre de caja en el punto 4, ADR-011). + * + * Lo único que la maqueta agrega de estado propio es la SEPARACIÓN entre + * mirar una orden cobrada y reembolsarla: el core enseña el teclado en + * cuanto la orden es cobrada; la maqueta pide un paso explícito + * («Reembolsar» → banner rojo → elegir renglones → confirmar). Ese modo + * vive en `beyondVista.reembolso` y no toca los datos: entrar y salir + * solo limpia las cantidades por devolver. + */ + +patch(TicketScreen.prototype, { + setup() { + super.setup(...arguments); + this.beyondVista = useState({ + // 'activas' | 'cobradas' | 'todas' — la pastilla elegida. + filtro: "activas", + reembolso: false, + }); + }, + + // ── La lista ──────────────────────────────────────────────────────── + + beyondPonerFiltro(filtro) { + this.beyondVista.filtro = filtro; + this.beyondVista.reembolso = false; + // «Todas» también pasa por SYNCED: es lo que trae las cobradas del + // servidor; la unión la hace beyondOrdenes. + this.onFilterSelected(filtro === "activas" ? "ACTIVE_ORDERS" : "SYNCED"); + }, + + beyondFiltros() { + return [ + { clave: "activas", rotulo: _t("Activas") }, + { clave: "cobradas", rotulo: _t("Cobradas") }, + { clave: "todas", rotulo: _t("Todas") }, + ]; + }, + + /** + * Un solo buscador para «número, folio o cliente». El buscador del + * core filtra por UN campo a la vez, así que el campo se decide por + * la forma de lo tecleado: con guion es folio, solo dígitos es + * número de orden, lo demás es cliente. Así la búsqueda sigue + * siendo la del core — con su viaje al servidor en las cobradas. + */ + beyondBuscarOrden(ev) { + const texto = ev.target.value.trim(); + let campo = "PARTNER"; + if (/^[\d\s-]+$/.test(texto)) { + campo = texto.includes("-") ? "RECEIPT_NUMBER" : "REFERENCE"; + } + this.onSearch({ ...this.state.search, fieldName: campo, searchTerm: texto }); + }, + + get beyondOrdenes() { + if (this.beyondVista.filtro !== "todas") { + return this.getFilteredOrderList(); + } + // La unión que el core no tiene: abiertas + cobradas, con el + // mismo criterio de pertenencia que usan sus dos filtros. + const modelo = this.pos.models["pos.order"]; + const abiertas = modelo.filter((o) => this.activeOrderFilter(o)); + const cobradas = modelo.filter((o) => o.finalized && o.uiState.displayed); + const q = (this.state.search?.searchTerm || "").toLowerCase(); + return [...abiertas, ...cobradas] + .filter((o) => !q + || String(o.getName()).toLowerCase().includes(q) + || (o.pos_reference || "").toLowerCase().includes(q) + || (o.partner_id?.name || "").toLowerCase().includes(q)) + .sort((a, b) => b.date_order - a.date_order); + }, + + get beyondTituloOrdenes() { + return { + activas: _t("Órdenes abiertas"), + cobradas: _t("Órdenes cobradas"), + todas: _t("Todas las órdenes"), + }[this.beyondVista.filtro]; + }, + + get beyondConteoOrdenes() { + const n = this.beyondOrdenes.length; + return n === 1 ? _t("1 orden") : _t("%s órdenes", n); + }, + + // ── Cada renglón de la lista ──────────────────────────────────────── + + beyondHoraDe(orden) { + // Sin segundos: el chip de la maqueta dice «11:27», no «11:27:05». + return orden.date_order?.toFormat?.("HH:mm") || this.pos.getTime(orden.date_order); + }, + + beyondDiaDe(orden) { + const hoy = luxon.DateTime.now(); + return orden.date_order?.hasSame?.(hoy, "day") + ? _t("Hoy") + : this.pos.getDate(orden.date_order); + }, + + beyondResumenDeOrden(orden) { + const nombres = orden.lines + .map((l) => l.full_product_name || l.product_id?.name) + .filter(Boolean); + return nombres.length ? nombres.join(" · ") : _t("Sin renglones"); + }, + + beyondMetaDeOrden(orden) { + if (!orden.lines.length) { + return _t("Creada a las %s", this.beyondHoraDe(orden)); + } + const piezas = orden.lines.reduce((suma, l) => suma + Math.abs(l.qty), 0); + const cuantas = piezas === 1 ? _t("1 pieza") : _t("%s piezas", piezas); + const quienes = [...new Set( + orden.lines.flatMap((l) => l.beyond_empleado_ids || []).map((e) => e.name) + )]; + return quienes.length ? `${cuantas} · ${quienes.join(", ")}` : cuantas; + }, + + beyondTotalDeOrden(orden) { + return this.getTotal(orden); + }, + + beyondTocarOrden(orden) { + if (orden.uuid !== this.state.selectedOrderUuid) { + this.beyondSalirReembolso(); + } + this.onClickOrder(orden); + }, + + beyondSePuedeBorrar(orden) { + return !orden.finalized && !this.shouldHideDeleteButton(orden); + }, + + // ── El detalle ────────────────────────────────────────────────────── + + get beyondOrdenVista() { + return this.getSelectedOrder(); + }, + + get beyondModo() { + const orden = this.beyondOrdenVista; + if (!orden) { + return "nada"; + } + if (!orden.finalized) { + return "cargar"; + } + return this.beyondVista.reembolso ? "reembolso" : "pagado"; + }, + + beyondEntrarReembolso() { + const orden = this.beyondOrdenVista; + this.beyondLimpiarDevoluciones(orden); + // El teclado del core escribe sobre el renglón seleccionado: + // sin uno, las teclas caen al vacío. + const primera = orden.getOrderlines()[0]; + if (primera) { + this.onClickOrderline(primera); + } + this.beyondVista.reembolso = true; + }, + + beyondSalirReembolso() { + if (this.beyondVista.reembolso) { + this.beyondLimpiarDevoluciones(this.beyondOrdenVista); + this.beyondVista.reembolso = false; + } + }, + + beyondLimpiarDevoluciones(orden) { + for (const linea of orden?.getOrderlines() || []) { + this.getToRefundDetail(linea).qty = 0; + } + }, + + beyondDevolubleDe(linea) { + return linea.qty - linea.refundedQty; + }, + + /** Si a la orden le queda algo por devolver. A un reembolso (líneas en + * negativo) o a una orden ya devuelta entera no se les ofrece el botón. */ + get beyondHayQueDevolver() { + return (this.beyondOrdenVista?.getOrderlines() || []) + .some((l) => this.beyondDevolubleDe(l) > 0); + }, + + /** Tocar un renglón en modo reembolso: lo enfoca y alterna 1 ↔ 0. */ + beyondTocarLinea(linea) { + if (this.beyondModo !== "reembolso") { + return; + } + const estabaEnfocada = linea.id === this.getSelectedOrderlineId(); + this.onClickOrderline(linea); + const detalle = this.getToRefundDetail(linea); + if (estabaEnfocada && detalle.qty > 0) { + detalle.qty = 0; + } else if (!detalle.qty) { + detalle.qty = Math.max(0, Math.min(1, this.beyondDevolubleDe(linea))); + } + }, + + beyondDevolverTodo() { + const orden = this.beyondOrdenVista; + const lineas = orden?.getOrderlines() || []; + const todo = lineas.length && lineas.every( + (l) => this.getToRefundDetail(l).qty === this.beyondDevolubleDe(l)); + for (const linea of lineas) { + this.getToRefundDetail(linea).qty = todo ? 0 : this.beyondDevolubleDe(linea); + } + }, + + get beyondTodoMarcado() { + const lineas = this.beyondOrdenVista?.getOrderlines() || []; + return lineas.length > 0 && lineas.every( + (l) => this.getToRefundDetail(l).qty === this.beyondDevolubleDe(l)); + }, + + get beyondLineaEnfocada() { + const id = this.getSelectedOrderlineId(); + const linea = this.beyondOrdenVista?.lines.find((l) => l.id === id); + return linea?.full_product_name || linea?.product_id?.name || _t("Toca un renglón"); + }, + + /** El teclado del reembolso, en el acomodo de la maqueta: + * 1 2 3 ⌫ / 4 5 6 C / 7 8 9 0. Las teclas siguen entrando por el + * numberBuffer DEL CORE (esta pantalla lo cablea en su setup), que + * es quien sabe del tope «no más de lo vendido». */ + getNumpadButtons() { + return [ + { value: "1" }, { value: "2" }, { value: "3" }, + { value: "Backspace", text: "⌫", class: "beyond_tecla_roja" }, + { value: "4" }, { value: "5" }, { value: "6" }, + { value: "Delete", text: "C", class: "beyond_tecla_roja" }, + { value: "7" }, { value: "8" }, { value: "9" }, { value: "0" }, + ]; + }, + + // ── Renglones y cuentas del detalle ───────────────────────────────── + + /** Cantidades como en la maqueta: enteras sin decimales («3», «−1»); + * solo las fraccionarias pasan por el formateador del core. */ + beyondCantidadFmt(q) { + return Number.isInteger(q) ? String(q) : this.env.utils.formatProductQty(q); + }, + + beyondQtyDe(linea) { + if (this.beyondModo !== "reembolso") { + return this.beyondCantidadFmt(linea.qty); + } + const q = this.getToRefundDetail(linea).qty; + return q > 0 ? "−" + this.beyondCantidadFmt(q) : "0"; + }, + + beyondMetaDeLinea(linea) { + const unitario = _t("%s c/u", this.env.utils.formatCurrency(linea.price_unit)); + if (this.beyondModo !== "reembolso") { + return unitario; + } + return _t("%s · vendidos %s", unitario, this.beyondCantidadFmt(linea.qty)); + }, + + beyondImporteDeLinea(linea) { + if (this.beyondModo !== "reembolso") { + return this.env.utils.formatCurrency(valorDeLinea(linea)); + } + const q = this.getToRefundDetail(linea).qty; + const parte = linea.qty ? (valorDeLinea(linea) * q) / linea.qty : 0; + return this.env.utils.formatCurrency(parte); + }, + + /** Total e impuestos del pie. En reembolso, la parte proporcional de + * los renglones marcados, EN NEGATIVO: es dinero que sale. */ + get beyondCuenta() { + const orden = this.beyondOrdenVista; + let total = 0; + let conIva = 0; + let sinIva = 0; + const reembolso = this.beyondModo === "reembolso"; + for (const linea of orden?.getOrderlines() || []) { + const parte = reembolso + ? (linea.qty ? this.getToRefundDetail(linea).qty / linea.qty : 0) + : 1; + total += valorDeLinea(linea) * parte; + conIva += (linea.price_subtotal_incl || 0) * parte; + sinIva += (linea.price_subtotal || 0) * parte; + } + const signo = reembolso ? -1 : 1; + return { + total: this.env.utils.formatCurrency(signo * total), + enRojo: reembolso && total > 0.004, + impuestos: this.env.utils.formatCurrency(signo * (conIva - sinIva)), + rotulo: reembolso ? _t("A devolver") : _t("Total"), + }; + }, +}); diff --git a/addons/beyond_pos_theme/static/src/ordenes/beyond_ordenes.xml b/addons/beyond_pos_theme/static/src/ordenes/beyond_ordenes.xml new file mode 100644 index 0000000..8e58c3f --- /dev/null +++ b/addons/beyond_pos_theme/static/src/ordenes/beyond_ordenes.xml @@ -0,0 +1,236 @@ + + + + + + + +
+ + +
+
+ +
+
+
+ +
+ + + + + + + + + +
+ +
+ + + + + +
+ Sin órdenes que mostrar + Cambia el filtro o crea una orden nueva con el botón + de la barra. +
+
+
+ + +
+ + + +
+ Elige una orden + Tócala en la lista para ver sus renglones aquí. +
+
+ + +
+
+ Orden + +
+ + Cobrada + En curso + + +
+ +
+ ! + Selecciona los productos a reembolsar y ajusta la cantidad. +
+ +
+ +
+ + + +
+ + + + + + +
+
+
+ +
+
+ + +
+
+ Cantidad + +
+ +
+
+
+ Orden sin renglones + Cárgala para empezar a agregar productos o servicios. +
+
+ +
+ +
+ Impuestos incluidos + +
+
+ + +
+ +
+ + +
+ +
+ + +
+ + + +
+
+
+
+
+
+ +
diff --git a/addons/beyond_pos_theme/static/src/scss/beyond_ordenes.scss b/addons/beyond_pos_theme/static/src/scss/beyond_ordenes.scss new file mode 100644 index 0000000..e4bc1bc --- /dev/null +++ b/addons/beyond_pos_theme/static/src/scss/beyond_ordenes.scss @@ -0,0 +1,652 @@ +// ============================================================================= +// Beyond — Órdenes, detalle y reembolso (rediseño 2-sep-2026, punto 7). +// La lista a la izquierda sobre el lienzo; el detalle en un panel blanco de +// 428px a la derecha — el mismo ancho que el ticket de venta y el cobro. +// ============================================================================= + +.pos .ticket-screen { + background: $caja-fondo; + + .beyond_ordenes { + display: flex; + align-items: stretch; + width: 100%; + height: 100%; + min-height: 0; + } + + // ── La lista ──────────────────────────────────────────────────────── + .beyond_ordenes_lienzo { + flex: 1; + min-width: 0; + box-sizing: border-box; + display: flex; + flex-direction: column; + gap: 14px; + padding: 18px 22px 22px; + } + + .beyond_ordenes_controles { + flex: none; + display: flex; + align-items: center; + gap: 10px; + } + + .beyond_filtros_pastillas { + flex: none; + display: flex; + align-items: center; + gap: 4px; + padding: 4px; + border-radius: $caja-radio-pill; + background: $caja-linea; + } + + .beyond_filtro_pastilla { + all: unset; + cursor: pointer; + box-sizing: border-box; + padding: 9px 16px; + border-radius: $caja-radio-pill; + font-size: 13.5px; + font-weight: 800; + color: $caja-tinta-media; + white-space: nowrap; + transition: background 140ms ease, color 140ms ease; + + &.beyond_activo { + background: $caja-verde; + color: #fff; + } + } + + .beyond_ordenes_titulo { + flex: none; + display: flex; + align-items: baseline; + justify-content: space-between; + gap: 12px; + + .beyond_titulo_texto { + font-size: 22px; + font-weight: 800; + letter-spacing: -0.025em; + } + + .beyond_titulo_conteo { + display: flex; + align-items: center; + gap: 6px; + font-size: 12.5px; + font-weight: 800; + letter-spacing: 0.06em; + text-transform: uppercase; + color: $caja-tinta-apagada; + } + } + + .beyond_pagina_flecha { + all: unset; + cursor: pointer; + width: 26px; + height: 26px; + border-radius: 9px; + display: flex; + align-items: center; + justify-content: center; + color: $caja-tinta-media; + + &:hover { background: $caja-suave; } + } + + .beyond_ordenes_lista { + flex: 1; + min-height: 0; + overflow: auto; + display: flex; + flex-direction: column; + gap: 10px; + padding-right: 2px; + } + + .beyond_orden_fila { + all: unset; + cursor: pointer; + box-sizing: border-box; + flex: none; + display: flex; + align-items: center; + gap: 12px; + padding: 14px; + border-radius: $caja-radio-tarjeta; + background: $caja-tarjeta; + border: 1.5px solid $caja-borde; + overflow: hidden; + transition: border-color 140ms ease, background 140ms ease; + + &:hover { border-color: $caja-verde; } + + &.beyond_elegida { + background: $caja-verde-tinte-suave; + border-color: $caja-verde; + + .beyond_orden_id { color: $caja-verde-tinta; } + .beyond_orden_hora { background: $caja-verde-palomita; color: $caja-verde-tinta; } + .beyond_orden_estado { background: $caja-tarjeta; } + } + + // La cobrada elegida CON el reembolso abierto: el rojo de la maqueta. + &.beyond_roja { + background: $caja-rojo-tinte; + border-color: $caja-rojo; + + .beyond_orden_id { color: $caja-rojo; } + .beyond_orden_hora { background: $caja-rojo-chip; color: $caja-rojo-tinta; } + } + } + + .beyond_orden_hora { + flex: none; + box-sizing: border-box; + min-width: 58px; + height: 46px; + padding: 0 9px; + border-radius: 14px; + background: $caja-suave; + color: $caja-tinta-media; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + gap: 2px; + + .beyond_hora_hh { font-size: 14px; font-weight: 800; line-height: 1; white-space: nowrap; } + .beyond_hora_dia { + font-size: 9.5px; + font-weight: 800; + letter-spacing: 0.06em; + line-height: 1; + text-transform: uppercase; + } + } + + .beyond_orden_centro { + flex: 1 1 150px; + min-width: 0; + display: flex; + flex-direction: column; + gap: 2px; + text-align: left; + overflow: hidden; + } + + .beyond_orden_ids { + display: flex; + align-items: baseline; + gap: 8px; + min-width: 0; + } + + .beyond_orden_id { + flex: none; + font-size: 17px; + font-weight: 800; + letter-spacing: -0.015em; + color: $caja-tinta; + } + + .beyond_orden_folio { + flex: 1; + min-width: 0; + font-size: 12px; + font-weight: 700; + color: $caja-tinta-apagada; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + + .beyond_orden_resumen { + font-size: 12.5px; + font-weight: 700; + color: $caja-tinta-media; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + + .beyond_orden_total { + flex: none; + font-size: 18px; + font-weight: 800; + letter-spacing: -0.02em; + + &.beyond_apagado { color: $caja-deshabilitado; } + } + + .beyond_orden_estado { + flex: none; + padding: 6px 12px; + border-radius: $caja-radio-pill; + background: $caja-suave; + color: $caja-tinta-media; + font-size: 11.5px; + font-weight: 800; + letter-spacing: 0.04em; + text-transform: uppercase; + white-space: nowrap; + } + + .beyond_orden_borrar { + flex: none; + width: 34px; + height: 34px; + border-radius: 12px; + display: flex; + align-items: center; + justify-content: center; + color: $caja-deshabilitado; + transition: background 140ms ease, color 140ms ease; + + &:hover { background: $caja-rojo-tinte; color: $caja-rojo; } + } + + .beyond_ordenes_vacio, + .beyond_detalle_vacio { + box-sizing: border-box; + padding: 70px 20px; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + gap: 8px; + text-align: center; + + .beyond_vacio_titulo { font-size: 16px; font-weight: 800; } + .beyond_vacio_nota { + font-size: 13.5px; + font-weight: 700; + color: $caja-tinta-apagada; + max-width: 280px; + text-wrap: pretty; + } + } + + .beyond_detalle_vacio { height: 100%; } + + // ── El detalle ────────────────────────────────────────────────────── + .beyond_detalle_panel { + flex: none; + width: 428px; + box-sizing: border-box; + display: flex; + flex-direction: column; + background: $caja-tarjeta; + box-shadow: -1px 0 0 rgba(96, 171, 106, 0.22), $caja-sombra-panel-der; + + &.beyond_borde_rojo { + box-shadow: -1px 0 0 rgba(192, 57, 43, 0.16), $caja-sombra-panel-der; + } + } + + .beyond_detalle_cabeza { + flex: none; + box-sizing: border-box; + padding: 16px 20px 14px; + border-bottom: 1px solid $caja-linea; + display: flex; + align-items: center; + gap: 12px; + } + + .beyond_detalle_quien { + flex: 1; + min-width: 0; + display: flex; + flex-direction: column; + gap: 2px; + } + + .beyond_detalle_id { + font-size: 24px; + font-weight: 800; + letter-spacing: -0.025em; + } + + // El chip de cabecera con la MISMA paleta que la lista: cobrada verde, + // en curso neutro (la corrección fechada 2-sep-2026 en la maqueta). + .beyond_detalle_estado { + flex: none; + padding: 7px 13px; + border-radius: $caja-radio-pill; + background: $caja-suave; + color: $caja-tinta-media; + font-size: 11.5px; + font-weight: 800; + letter-spacing: 0.04em; + text-transform: uppercase; + + &.beyond_cobrada { + background: $caja-verde-tinte; + color: $caja-verde-tinta; + } + } + + .beyond_quitar_grande { + all: unset; + cursor: pointer; + flex: none; + width: 34px; + height: 34px; + border-radius: 12px; + display: flex; + align-items: center; + justify-content: center; + color: $caja-tinta-apagada; + transition: background 140ms ease, color 140ms ease; + + &:hover { background: $caja-rojo-tinte; color: $caja-rojo; } + } + + .beyond_reembolso_banner { + flex: none; + box-sizing: border-box; + margin: 10px 20px 0; + padding: 9px 12px; + border-radius: 13px; + background: $caja-rojo-tinte; + display: flex; + align-items: center; + gap: 10px; + font-size: 12.5px; + font-weight: 800; + color: $caja-rojo-tinta; + text-wrap: pretty; + + .beyond_banner_signo { + flex: none; + width: 26px; + height: 26px; + border-radius: 9px; + background: $caja-rojo-chip; + display: flex; + align-items: center; + justify-content: center; + font-size: 14px; + } + } + + .beyond_detalle_cuerpo { + flex: 1 1 120px; + min-height: 108px; + overflow: auto; + } + + .beyond_detalle_lineas { + display: flex; + flex-direction: column; + padding-top: 4px; + } + + .beyond_detalle_linea { + box-sizing: border-box; + display: flex; + align-items: center; + gap: 12px; + padding: 13px 20px; + border-bottom: 1px solid $caja-fondo; + transition: background 140ms ease; + + &.beyond_tocable { cursor: pointer; } + + &.beyond_enfocada { + background: $caja-rojo-tinte; + box-shadow: inset 3px 0 0 $caja-rojo; + } + } + + .beyond_linea_qty { + flex: none; + min-width: 34px; + height: 30px; + box-sizing: border-box; + padding: 0 8px; + border-radius: 10px; + background: $caja-suave; + color: $caja-tinta-suave; + font-size: 14px; + font-weight: 800; + display: flex; + align-items: center; + justify-content: center; + + &.beyond_qty_roja { + background: $caja-rojo-chip; + color: $caja-rojo-tinta; + } + } + + .beyond_linea_datos { + flex: 1; + min-width: 0; + display: flex; + flex-direction: column; + gap: 1px; + } + + .beyond_linea_nombre { + font-size: 15px; + font-weight: 800; + letter-spacing: -0.01em; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + + .beyond_linea_meta { + font-size: 12px; + font-weight: 700; + color: $caja-tinta-apagada; + } + + .beyond_linea_importe { + flex: none; + font-size: 15px; + font-weight: 800; + + &.beyond_rojo { color: $caja-rojo; } + &.beyond_apagado { color: $caja-deshabilitado; } + } + + // ── Los mandos del reembolso ──────────────────────────────────────── + .beyond_reembolso_mandos { + box-sizing: border-box; + padding: 12px 20px 16px; + display: flex; + flex-direction: column; + gap: 8px; + } + + .beyond_reembolso_acciones { + display: flex; + align-items: center; + gap: 6px; + } + + .beyond_accion_chica { + all: unset; + cursor: pointer; + box-sizing: border-box; + flex: 1; + min-width: 0; + display: flex; + align-items: center; + justify-content: center; + padding: 8px 6px; + border-radius: 12px; + background: $caja-suave; + color: $caja-tinta; + font-size: 12px; + font-weight: 800; + white-space: nowrap; + transition: background 140ms ease; + + &:hover { background: $caja-borde; } + } + + .beyond_reembolso_foco { + display: flex; + align-items: center; + justify-content: space-between; + gap: 10px; + + .beyond_foco_nombre { + font-size: 12.5px; + font-weight: 800; + color: $caja-rojo-tinta; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + } + + // El Numpad del core con la ropa de la maqueta: 4 columnas parejas. + .beyond_teclado_reembolso { + display: grid !important; + grid-template-columns: repeat(4, 1fr); + gap: 5px; + + .numpad-button { + all: unset; + cursor: pointer; + box-sizing: border-box; + display: flex; + align-items: center; + justify-content: center; + padding: 9px 0; + border-radius: 12px; + background: $caja-fondo; + color: $caja-tinta; + font-size: 15px; + font-weight: 800; + font-variant-numeric: tabular-nums; + transition: background 140ms ease; + + &:hover { background: $caja-linea; } + + &.beyond_tecla_roja { + background: $caja-rojo-tinte; + color: $caja-rojo-tinta; + + &:hover { background: $caja-rojo-chip; } + } + } + } + + // ── El pie ────────────────────────────────────────────────────────── + .beyond_detalle_pie { + flex: none; + box-sizing: border-box; + padding: 12px 20px 14px; + border-top: 1px solid $caja-linea; + display: flex; + flex-direction: column; + gap: 10px; + } + + .beyond_pie_renglon { + display: flex; + align-items: baseline; + justify-content: space-between; + gap: 12px; + font-size: 13.5px; + font-weight: 700; + color: $caja-tinta-media; + + .beyond_num { font-size: 14px; color: $caja-tinta-suave; } + } + + .beyond_pie_total { + display: flex; + align-items: baseline; + justify-content: space-between; + gap: 12px; + padding-top: 8px; + border-top: 1.5px solid $caja-linea; + font-size: 15px; + font-weight: 800; + letter-spacing: -0.01em; + + .beyond_total_cifra { + font-size: 27px; + letter-spacing: -0.03em; + line-height: 1.05; + + &.beyond_rojo { color: $caja-rojo; } + } + } + + .beyond_pie_botones { + display: flex; + align-items: center; + gap: 8px; + } + + .beyond_btn_cargar { flex: 1; } + .beyond_btn_recibo { flex: 1; } + + .beyond_btn_borrar_orden:hover { + background: $caja-rojo-tinte; + color: $caja-rojo; + } + + .beyond_reembolsar_pastilla { + all: unset; + cursor: pointer; + box-sizing: border-box; + flex: none; + display: flex; + align-items: center; + gap: 6px; + padding: 10px 14px; + border-radius: $caja-radio-pill; + background: $caja-rojo-chip; + color: $caja-rojo-tinta; + font-size: 12.5px; + font-weight: 800; + white-space: nowrap; + transition: background 140ms ease, color 140ms ease; + + &:hover { background: $caja-rojo; color: #fff; } + } + + .beyond_btn_reembolsar { + all: unset; + cursor: pointer; + box-sizing: border-box; + flex: none; + display: flex; + align-items: center; + justify-content: space-between; + gap: 14px; + padding: 14px 20px; + border-radius: 16px; + background: $caja-rojo; + color: #fff; + font-size: 16px; + font-weight: 800; + letter-spacing: -0.01em; + transition: background 140ms ease; + + &:hover { background: $caja-rojo-tinta; } + + .beyond_num { font-size: 18px; } + + &:disabled { + cursor: not-allowed; + background: $caja-borde; + color: $caja-tinta-apagada; + } + } +} diff --git a/addons/beyond_pos_theme/static/src/scss/beyond_venta.scss b/addons/beyond_pos_theme/static/src/scss/beyond_venta.scss index 975349f..6b8132c 100644 --- a/addons/beyond_pos_theme/static/src/scss/beyond_venta.scss +++ b/addons/beyond_pos_theme/static/src/scss/beyond_venta.scss @@ -305,31 +305,6 @@ padding: 10px 22px 12px; } - .beyond_buscador { - flex: 1; - min-width: 0; - display: flex; - align-items: center; - gap: 11px; - box-sizing: border-box; - padding: 11px 14px; - border-radius: $caja-radio-campo; - background: $caja-tarjeta; - border: 1.5px solid $caja-borde; - - &:focus-within { border-color: $caja-verde; } - - .fa { color: $caja-tinta-apagada; } - - input { - all: unset; - flex: 1; - min-width: 0; - font-size: 14.5px; - font-weight: 700; - color: $caja-tinta; - } - } .beyond_escanear { all: unset; @@ -605,3 +580,33 @@ &.beyond_apagado { color: $caja-tinta-apagada; } } } + +// El buscador de la caja: nació en el catálogo (P2) y lo reutilizan las +// órdenes (P7), así que vive al alcance de todo el punto de venta. +.pos { + .beyond_buscador { + flex: 1; + min-width: 0; + display: flex; + align-items: center; + gap: 11px; + box-sizing: border-box; + padding: 11px 14px; + border-radius: $caja-radio-campo; + background: $caja-tarjeta; + border: 1.5px solid $caja-borde; + + &:focus-within { border-color: $caja-verde; } + + .fa { color: $caja-tinta-apagada; } + + input { + all: unset; + flex: 1; + min-width: 0; + font-size: 14.5px; + font-weight: 700; + color: $caja-tinta; + } + } +} diff --git a/addons/beyond_pos_theme/tests/test_contrato_pos.py b/addons/beyond_pos_theme/tests/test_contrato_pos.py index 5a128a7..bcba061 100644 --- a/addons/beyond_pos_theme/tests/test_contrato_pos.py +++ b/addons/beyond_pos_theme/tests/test_contrato_pos.py @@ -105,7 +105,7 @@ class TestBeyondContratoPos(TransactionCase): for ruta, texto in self._nuestro_codigo_pos(): for objeto, metodo in re.findall( r'(?