El desglose de ventas viene colapsado tras 'Ver detalle'

El resumen (monto, servicios y ticket promedio) sigue siempre a la vista;
solo la tabla se pliega. Va con <details> nativo del navegador: cero
JavaScript en una página que hoy no carga ninguno, accesible por teclado y
sin estado que sincronizar. La etiqueta cambia sola a 'Ocultar detalle'
con CSS según el estado abierto, y el botón mide 44px de alto.
This commit is contained in:
Jorem Juárez committed 2026-08-19 12:37:24 -06:00
1 parent 57a978abf1
commit 0a876efd1f
2 files changed
+62 -24

No files matched your search

@@ -268,3 +268,18 @@ class TestBeyondPortalVentas(HttpCase):
self.assertIn('$300.00', pagina.text)
self.assertNotIn('Clienta Reservada', pagina.text,
'el cliente es dato del negocio, no del desglose')
def test_el_desglose_viene_colapsado_tras_un_boton(self):
"""El resumen se ve siempre; la tabla solo si la piden. El estado se
nota en la propia etiqueta del botón."""
self._venta(300.0, self.empleada)
self.authenticate('2226660001', 'clave-ventas-8')
pagina = self.url_open('/beyond/mi')
self.assertIn('ticket promedio', pagina.text, 'el resumen sigue visible')
self.assertIn('$300.00', pagina.text)
self.assertIn('Ver detalle', pagina.text)
self.assertIn('Ocultar detalle', pagina.text,
'la etiqueta del estado desplegado debe existir')
self.assertIn('<details', pagina.text)
self.assertNotRegex(pagina.text, r'<details[^>]*\bopen\b',
'el desglose debe venir colapsado por defecto')
@@ -66,6 +66,18 @@
.cifras > div { flex: 1; }
.cifras b { display: block; font-size: 1.35rem; color: #1f2421; }
.cifras span { font-size: .8rem; color: #666; }
.detalle { margin-top: .75rem; }
.detalle summary {
list-style: none; cursor: pointer; min-height: 2.75rem;
display: flex; align-items: center; justify-content: center;
border-radius: .75rem; background: #f0ede6; color: #0f6b5c;
font-weight: 600; font-size: .95rem; user-select: none;
}
.detalle summary::-webkit-details-marker { display: none; }
.detalle .ocultar { display: none; }
.detalle[open] .ver { display: none; }
.detalle[open] .ocultar { display: inline; }
.detalle[open] summary { margin-bottom: .25rem; }
.desglose { margin-top: .75rem; font-size: .85rem; }
.desglose .num { text-align: right; white-space: nowrap; }
.desglose .total td {
@@ -125,31 +137,42 @@
<p t-if="not ventas['servicios']" class="vacio">
Sin ventas atribuidas en este mes.
</p>
</div>
<table t-if="ventas['lineas']" class="desglose">
<tr>
<th>Fecha</th><th>Servicio/Producto</th>
<th class="num">Cant.</th><th class="num">Precio</th>
<th class="num">Atribuido</th>
</tr>
<tr t-foreach="ventas['lineas']" t-as="linea">
<td t-out="linea['fecha']"/>
<td t-out="linea['producto']"/>
<td class="num" t-out="'%g' % linea['cantidad']"/>
<td class="num" t-out="'$' + '{:,.2f}'.format(linea['precio'])"/>
<td class="num">
<t t-out="'$' + '{:,.2f}'.format(linea['atribuido'])"/>
<span t-if="linea['compartido']" class="pill compartido"
title="El servicio se atendió entre varias personas y el monto se repartió en partes iguales">compartido</span>
</td>
</tr>
<tr class="total">
<td colspan="4">Total</td>
<td class="num"
t-out="'$' + '{:,.2f}'.format(ventas['monto'])"/>
</tr>
</table>
<!-- Colapsado por defecto con <details>: nativo del
navegador, sin una línea de JavaScript en una
página que hoy no carga ninguno, y accesible por
teclado. La etiqueta cambia sola con CSS según
el estado abierto. -->
<details t-if="ventas['lineas']" class="detalle">
<summary>
<span class="ver">Ver detalle ▾</span>
<span class="ocultar">Ocultar detalle ▴</span>
</summary>
<table class="desglose">
<tr>
<th>Fecha</th><th>Servicio/Producto</th>
<th class="num">Cant.</th><th class="num">Precio</th>
<th class="num">Atribuido</th>
</tr>
<tr t-foreach="ventas['lineas']" t-as="linea">
<td t-out="linea['fecha']"/>
<td t-out="linea['producto']"/>
<td class="num" t-out="'%g' % linea['cantidad']"/>
<td class="num" t-out="'$' + '{:,.2f}'.format(linea['precio'])"/>
<td class="num">
<t t-out="'$' + '{:,.2f}'.format(linea['atribuido'])"/>
<span t-if="linea['compartido']" class="pill compartido"
title="El servicio se atendió entre varias personas y el monto se repartió en partes iguales">compartido</span>
</td>
</tr>
<tr class="total">
<td colspan="4">Total</td>
<td class="num"
t-out="'$' + '{:,.2f}'.format(ventas['monto'])"/>
</tr>
</table>
</details>
</div>
</t>
<h2>Mis jornadas recientes</h2>