Sube Consumo Beyond al encabezado y limpia la miga y el Estado
Las tres cifras de consumo dejan de ser burbujas grises en el cuerpo y pasan a ser tarjetas iguales a Visitas y Gasto acumulado, en la misma fila: cinco en total, con su icono naranja, etiqueta en versalitas y valor en negritas. Las dos primeras siguen abriendo el historial; las tres nuevas son informativas y no hacen nada al tocarlas. El cuerpo queda en foto, campos y pie. La tira NO usa oe_button_box, y no por gusto: el ButtonBox de Odoo decide cuántos botones caben según el tamaño de pantalla —cuatro en pantalla mediana— y esconde el resto en un desplegable «More». Con cinco tarjetas, a 1024px se habrían ocultado dos. Aquí se acomodan en dos renglones y, si aun así no caben, la tira se desplaza dentro de sí misma sin mover la página; hay prueba de navegador de que ninguna se encima con la vecina. La píldora de vuelta va sola sobre el fondo del panel: los contenedores de la miga traían su propia caja blanca con borde, que alrededor de un botón con forma propia se leía como un recuadro sobrante. La prueba recorre los contenedores de la píldora hasta el panel de control y exige que ninguno tenga fondo opaco ni borde. Y fuera el Estado de la ficha: quedan Dirección y Ciudad. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
1f32e87123
commit
f7a8d02ac0
5 files changed
+218
-84
No files matched your search
@@ -106,11 +106,22 @@ class TestPanelEnNavegador(HttpCase):
|
||||
+ ', retrato.right=' + Math.round(r.right) + ')');
|
||||
}
|
||||
const nombres = [...campos.querySelectorAll('.beyond_campo')].length;
|
||||
if (nombres !== 6) {
|
||||
throw new Error('la columna tiene ' + nombres + ' campos y deben ser 6');
|
||||
if (nombres !== 5) {
|
||||
throw new Error('la columna tiene ' + nombres + ' campos y deben ser 5');
|
||||
}
|
||||
if (!document.querySelectorAll('.beyond_dato').length) {
|
||||
throw new Error('Consumo Beyond no está en tarjetas');
|
||||
const tarjetas = document.querySelectorAll('.beyond_ficha_stats .beyond_stat');
|
||||
if (tarjetas.length !== 5) {
|
||||
throw new Error('el encabezado tiene ' + tarjetas.length
|
||||
+ ' tarjetas y deben ser cinco');
|
||||
}
|
||||
// Ninguna encimada: cada una empieza donde acaba la anterior,
|
||||
// o en el renglón de abajo.
|
||||
for (let i = 1; i < tarjetas.length; i++) {
|
||||
const a = tarjetas[i - 1].getBoundingClientRect();
|
||||
const b = tarjetas[i].getBoundingClientRect();
|
||||
if (b.left < a.right - 1 && b.top < a.bottom - 1) {
|
||||
throw new Error('las tarjetas del encabezado se encinan');
|
||||
}
|
||||
}
|
||||
if (!document.querySelector('.beyond_boton_guardar')) {
|
||||
throw new Error('el pie no tiene Guardar explícito');
|
||||
@@ -131,6 +142,20 @@ class TestPanelEnNavegador(HttpCase):
|
||||
if (!pildora || getComputedStyle(pildora).borderRadius === '0px') {
|
||||
throw new Error('la miga no es la píldora de vuelta');
|
||||
}
|
||||
// La píldora va sola sobre el fondo del panel: ningún
|
||||
// contenedor suyo puede traer caja blanca ni borde.
|
||||
for (let n = pildora.parentElement;
|
||||
n && !n.classList.contains('o_control_panel');
|
||||
n = n.parentElement) {
|
||||
const s = getComputedStyle(n);
|
||||
const fondo = s.backgroundColor;
|
||||
const opaco = fondo !== 'rgba(0, 0, 0, 0)' && fondo !== 'transparent';
|
||||
if (opaco || parseFloat(s.borderTopWidth) > 0) {
|
||||
throw new Error('la píldora lleva caja detrás: '
|
||||
+ (n.className || n.tagName) + ' → ' + fondo
|
||||
+ ' / borde ' + s.borderTopWidth);
|
||||
}
|
||||
}
|
||||
// La nube y la X nativas serían la misma acción por segunda
|
||||
// vez, y el diseño no las dibuja.
|
||||
const nativos = document.querySelector('.o_form_status_indicator');
|
||||
|
||||
@@ -239,6 +239,18 @@ body.beyond_panel {
|
||||
// «Nuevo» no va en una ficha: vive en la kanban y en la lista.
|
||||
.o_form_button_create { display: none !important; }
|
||||
|
||||
// La píldora va SOLA sobre el fondo del panel. Los contenedores de la
|
||||
// miga traen su propia caja blanca con borde, que alrededor de un
|
||||
// botón con forma propia se lee como un recuadro sobrante.
|
||||
.o_control_panel_breadcrumbs,
|
||||
.o_breadcrumb,
|
||||
.o_breadcrumb .breadcrumb,
|
||||
.o_breadcrumb .breadcrumb-item {
|
||||
background: transparent;
|
||||
border: 0;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
// El camino de vuelta, como píldora gris con su flecha.
|
||||
.o_breadcrumb .breadcrumb {
|
||||
margin: 0;
|
||||
|
||||
@@ -225,51 +225,70 @@ body.beyond_panel {
|
||||
}
|
||||
}
|
||||
|
||||
// ── 2 · Consumo Beyond ────────────────────────────────────────────────
|
||||
.beyond_consumo {
|
||||
// ── Encabezado: las cinco tarjetas ────────────────────────────────────
|
||||
// Las tres de consumo se ven IGUAL que Visitas y Gasto: misma tarjeta
|
||||
// blanca con borde, icono naranja a la izquierda, etiqueta en versalitas
|
||||
// y valor en negritas. La diferencia es de comportamiento, no de forma:
|
||||
// las dos primeras abren el historial y las tres nuevas no hacen nada.
|
||||
.beyond_ficha_stats {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 14px;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-end;
|
||||
align-items: stretch;
|
||||
gap: 8px;
|
||||
margin-bottom: 26px;
|
||||
}
|
||||
|
||||
.beyond_consumo_titulo {
|
||||
font-size: 12px;
|
||||
font-weight: 800;
|
||||
letter-spacing: 0.1em;
|
||||
text-transform: uppercase;
|
||||
color: $beyond-panel-acento;
|
||||
}
|
||||
|
||||
.beyond_consumo_rejilla {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
// Tarjeta gris por dato, no tres etiquetas sueltas en línea.
|
||||
.beyond_dato {
|
||||
.beyond_stat {
|
||||
all: unset;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
padding: 14px 18px;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 10px 18px;
|
||||
border: 1px solid $beyond-surface-active;
|
||||
border-radius: 18px;
|
||||
background: $beyond-surface;
|
||||
background: #FFFFFF;
|
||||
color: $beyond-panel-acento; // lo heredan los iconos
|
||||
min-width: 0;
|
||||
|
||||
.beyond_dato_etiqueta {
|
||||
font-size: 11px;
|
||||
font-weight: 800;
|
||||
letter-spacing: 0.06em;
|
||||
text-transform: uppercase;
|
||||
color: $beyond-ink-muted;
|
||||
}
|
||||
> svg { flex: none; }
|
||||
}
|
||||
|
||||
.o_field_widget {
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
color: $beyond-ink;
|
||||
// Solo las dos con acción invitan a tocarlas.
|
||||
.beyond_stat_accion {
|
||||
cursor: pointer;
|
||||
transition: background 140ms ease, border-color 140ms ease;
|
||||
|
||||
&:hover, &:focus-visible {
|
||||
background: $beyond-surface;
|
||||
border-color: $beyond-panel-acento;
|
||||
}
|
||||
}
|
||||
|
||||
.beyond_stat_texto {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.beyond_stat_etiqueta {
|
||||
font-size: 11px;
|
||||
font-weight: 800;
|
||||
letter-spacing: 0.06em;
|
||||
text-transform: uppercase;
|
||||
color: $beyond-ink-muted;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.beyond_stat_valor,
|
||||
.beyond_stat_valor .o_field_widget {
|
||||
font-size: 15px;
|
||||
font-weight: 800;
|
||||
color: $beyond-ink;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
// ── 3 · Pie ───────────────────────────────────────────────────────────
|
||||
.beyond_cliente_acciones {
|
||||
display: flex;
|
||||
@@ -287,6 +306,20 @@ body.beyond_panel {
|
||||
.beyond_cliente_retrato { width: 200px; }
|
||||
}
|
||||
|
||||
// A 800 y 600 las cinco tarjetas no caben en un renglón. Se acomodan en
|
||||
// dos —nunca encimadas— y si aun así no caben, la tira se desplaza en
|
||||
// horizontal dentro de sí misma, sin mover la página.
|
||||
@media (max-width: 991px) {
|
||||
.beyond_ficha_stats {
|
||||
justify-content: flex-start;
|
||||
overflow-x: auto;
|
||||
scrollbar-width: none;
|
||||
&::-webkit-scrollbar { display: none; }
|
||||
}
|
||||
|
||||
.beyond_stat { padding: 10px 14px; }
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
// El retrato pasa arriba y a ancho completo: a 600px una columna de
|
||||
// 250px al lado deja los campos en una franja inservible.
|
||||
|
||||
@@ -105,7 +105,7 @@ class TestClientesVistas(TransactionCase):
|
||||
|
||||
def test_la_ficha_tiene_lo_del_diseno(self):
|
||||
arch = etree.fromstring(self._arch('beyond_customer.view_beyond_cliente_form'))
|
||||
for campo in ('name', 'phone', 'street', 'state_id', 'comment',
|
||||
for campo in ('name', 'phone', 'street', 'city', 'comment',
|
||||
'beyond_last_visit', 'beyond_usual_branch_id',
|
||||
'beyond_avg_ticket'):
|
||||
self.assertTrue(arch.xpath(f"//field[@name='{campo}']"),
|
||||
@@ -136,12 +136,46 @@ class TestClientesVistas(TransactionCase):
|
||||
self.assertNotIn(chico, opciones,
|
||||
f"la previsualización volvió a una variante chica ({chico})")
|
||||
|
||||
def test_las_estadisticas_son_solo_dos(self):
|
||||
"""Visitas y Gasto acumulado. «Órdenes de PdV» salió del diseño."""
|
||||
def test_el_encabezado_lleva_cinco_tarjetas(self):
|
||||
"""Visitas y Gasto acumulado, más las tres de consumo, todas con la
|
||||
misma forma. «Órdenes de PdV» salió del diseño."""
|
||||
arch = etree.fromstring(self._arch('beyond_customer.view_beyond_cliente_form'))
|
||||
botones = arch.xpath("//div[@name='button_box']//button")
|
||||
self.assertEqual(len(botones), 2,
|
||||
f"la ficha tiene {len(botones)} botones estadísticos y deben ser dos")
|
||||
tarjetas = arch.xpath("//div[hasclass('beyond_ficha_stats')]"
|
||||
"/*[hasclass('beyond_stat')]")
|
||||
self.assertEqual(len(tarjetas), 5,
|
||||
f"el encabezado tiene {len(tarjetas)} tarjetas y deben ser cinco")
|
||||
|
||||
campos = [t.xpath('.//field/@name')[0] for t in tarjetas]
|
||||
self.assertEqual(campos, ['beyond_visit_count', 'beyond_total_spent',
|
||||
'beyond_last_visit', 'beyond_usual_branch_id',
|
||||
'beyond_avg_ticket'])
|
||||
|
||||
def test_solo_dos_tarjetas_llevan_accion(self):
|
||||
"""Las tres de consumo son informativas: tocarlas no hace nada."""
|
||||
arch = etree.fromstring(self._arch('beyond_customer.view_beyond_cliente_form'))
|
||||
con_accion = arch.xpath("//div[hasclass('beyond_ficha_stats')]"
|
||||
"/button[@name='action_view_beyond_orders']")
|
||||
self.assertEqual(len(con_accion), 2)
|
||||
informativas = arch.xpath("//div[hasclass('beyond_ficha_stats')]"
|
||||
"/div[hasclass('beyond_stat')]")
|
||||
self.assertEqual(len(informativas), 3)
|
||||
for tarjeta in informativas:
|
||||
self.assertFalse(tarjeta.xpath('.//button'),
|
||||
"una tarjeta informativa no lleva botón dentro")
|
||||
|
||||
def test_el_cuerpo_ya_no_tiene_seccion_de_consumo(self):
|
||||
"""Las tres burbujas grises subieron al encabezado: el cuerpo queda en
|
||||
foto, campos y pie."""
|
||||
arch = etree.fromstring(self._arch('beyond_customer.view_beyond_cliente_form'))
|
||||
self.assertFalse(arch.xpath("//div[hasclass('beyond_consumo')]"),
|
||||
"el bloque Consumo Beyond sigue en el cuerpo")
|
||||
self.assertFalse(arch.xpath("//div[hasclass('beyond_dato')]"),
|
||||
"quedaron burbujas grises de consumo en el cuerpo")
|
||||
|
||||
def test_la_ficha_no_pregunta_el_estado(self):
|
||||
"""Fuera state_id (25-ago-2026): quedan Dirección y Ciudad."""
|
||||
arch = etree.fromstring(self._arch('beyond_customer.view_beyond_cliente_form'))
|
||||
self.assertFalse(arch.xpath("//field[@name='state_id']"))
|
||||
|
||||
def test_la_lista_lleva_las_columnas_del_diseno(self):
|
||||
arch = etree.fromstring(self._arch('beyond_customer.view_beyond_cliente_list'))
|
||||
@@ -216,12 +250,8 @@ class TestClientesVistas(TransactionCase):
|
||||
campos = principal[0].xpath(
|
||||
".//div[hasclass('beyond_cliente_campos')]//field/@name")
|
||||
self.assertEqual(
|
||||
list(campos), ['name', 'phone', 'street', 'city', 'state_id', 'comment'],
|
||||
"la columna de campos no tiene los seis del diseño, en orden")
|
||||
|
||||
datos = arch.xpath("//div[hasclass('beyond_consumo_rejilla')]"
|
||||
"/div[hasclass('beyond_dato')]")
|
||||
self.assertEqual(len(datos), 3, "Consumo Beyond debe ser tres tarjetas")
|
||||
list(campos), ['name', 'phone', 'street', 'city', 'comment'],
|
||||
"la columna de campos no tiene los cinco del diseño, en orden")
|
||||
|
||||
def test_el_pie_lleva_guardar_y_descartar_explicitos(self):
|
||||
"""ADR-012 §6: el icono de nube no es evidente, y además solo aparece
|
||||
|
||||
@@ -154,20 +154,79 @@
|
||||
<field name="arch" type="xml">
|
||||
<form string="Cliente" class="o_beyond_cliente_form">
|
||||
<sheet>
|
||||
<!-- Solo dos estadísticas, las del diseño. -->
|
||||
<div class="oe_button_box" name="button_box">
|
||||
<!-- ══ Encabezado: cinco tarjetas ══
|
||||
NO usa oe_button_box. El ButtonBox de Odoo decide
|
||||
cuántos botones caben según el tamaño de pantalla
|
||||
(maxVisibleButtons: 4 en pantalla mediana) y mete el
|
||||
resto en un desplegable «More»: con cinco tarjetas,
|
||||
a 1024px se habrían escondido dos. El diseño pide que
|
||||
se vean las cinco y que en pantallas chicas se
|
||||
acomoden en dos renglones, no que se oculten.
|
||||
|
||||
Las dos primeras abren el historial; las tres de
|
||||
consumo son informativas y no llevan acción. -->
|
||||
<div class="beyond_ficha_stats">
|
||||
<field name="currency_id" invisible="1"/>
|
||||
|
||||
<button name="action_view_beyond_orders" type="object"
|
||||
class="oe_stat_button" icon="fa-shopping-bag">
|
||||
<field name="beyond_visit_count" widget="statinfo" string="Visitas"/>
|
||||
class="beyond_stat beyond_stat_accion">
|
||||
<svg width="18" height="18" viewBox="0 0 48 48" fill="none" aria-hidden="true">
|
||||
<path d="M11 16h26l3.2 25.3A3.5 3.5 0 0 1 36.7 45H11.3a3.5 3.5 0 0 1-3.5-3.7L11 16Z" fill="currentColor"/>
|
||||
<path d="M16.5 16a7.5 7.5 0 0 1 15 0" stroke="currentColor" stroke-width="4.5" fill="none" stroke-linecap="round"/>
|
||||
</svg>
|
||||
<div class="beyond_stat_texto">
|
||||
<span class="beyond_stat_etiqueta">Visitas</span>
|
||||
<field name="beyond_visit_count" class="beyond_stat_valor"/>
|
||||
</div>
|
||||
</button>
|
||||
|
||||
<button name="action_view_beyond_orders" type="object"
|
||||
class="oe_stat_button" icon="fa-money">
|
||||
<field name="beyond_total_spent" widget="statinfo" string="Gasto acumulado"/>
|
||||
class="beyond_stat beyond_stat_accion">
|
||||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" aria-hidden="true">
|
||||
<rect x="2" y="5" width="20" height="14" rx="3" fill="currentColor"/>
|
||||
<circle cx="12" cy="12" r="3.4" fill="#FFFFFF"/>
|
||||
</svg>
|
||||
<div class="beyond_stat_texto">
|
||||
<span class="beyond_stat_etiqueta">Gasto acumulado</span>
|
||||
<field name="beyond_total_spent" class="beyond_stat_valor"/>
|
||||
</div>
|
||||
</button>
|
||||
|
||||
<div class="beyond_stat">
|
||||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" aria-hidden="true">
|
||||
<rect x="3.2" y="5" width="17.6" height="15.4" rx="2.6" stroke="currentColor" stroke-width="1.8"/>
|
||||
<path d="M3.2 9.6h17.6M8 3.4v3.4M16 3.4v3.4" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/>
|
||||
</svg>
|
||||
<div class="beyond_stat_texto">
|
||||
<span class="beyond_stat_etiqueta">Última visita</span>
|
||||
<field name="beyond_last_visit" class="beyond_stat_valor" readonly="1"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="beyond_stat">
|
||||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" aria-hidden="true">
|
||||
<path d="M4 9.6V19a1.4 1.4 0 0 0 1.4 1.4h13.2A1.4 1.4 0 0 0 20 19V9.6" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"/>
|
||||
<path d="M3 9.6 5.2 4h13.6L21 9.6a2.6 2.6 0 0 1-4.5 1.7 2.6 2.6 0 0 1-4.5 0 2.6 2.6 0 0 1-4.5 0A2.6 2.6 0 0 1 3 9.6Z" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
<div class="beyond_stat_texto">
|
||||
<span class="beyond_stat_etiqueta">Sucursal habitual</span>
|
||||
<field name="beyond_usual_branch_id" class="beyond_stat_valor" readonly="1"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="beyond_stat">
|
||||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" aria-hidden="true">
|
||||
<path d="M5 3.4h14v17.2l-2.3-1.4-2.4 1.4-2.3-1.4-2.4 1.4L7.3 19.2 5 20.6V3.4Z" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"/>
|
||||
<path d="M8.6 8.4h6.8M8.6 12.4h4.6" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/>
|
||||
</svg>
|
||||
<div class="beyond_stat_texto">
|
||||
<span class="beyond_stat_etiqueta">Ticket promedio</span>
|
||||
<field name="beyond_avg_ticket" class="beyond_stat_valor" readonly="1"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ══ 1 · Fila principal: retrato y columna de campos ══ -->
|
||||
<!-- ══ 1 · Cuerpo: retrato y columna de campos ══ -->
|
||||
<div class="beyond_cliente_principal">
|
||||
<div class="beyond_cliente_retrato">
|
||||
<!-- image_1024 y no avatar_128: el recuadro mide
|
||||
@@ -200,12 +259,6 @@
|
||||
<span class="beyond_campo_etiqueta">Ciudad</span>
|
||||
<field name="city" nolabel="1" placeholder="Ciudad"/>
|
||||
</div>
|
||||
<div class="beyond_campo">
|
||||
<span class="beyond_campo_etiqueta">Estado</span>
|
||||
<field name="state_id" nolabel="1"
|
||||
placeholder="Por ejemplo, Puebla"
|
||||
options="{'no_open': True, 'no_quick_create': True}"/>
|
||||
</div>
|
||||
<div class="beyond_campo beyond_campo_notas">
|
||||
<span class="beyond_campo_etiqueta">Notas</span>
|
||||
<field name="comment" nolabel="1"
|
||||
@@ -214,26 +267,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ══ 2 · Consumo Beyond ══ -->
|
||||
<div class="beyond_consumo">
|
||||
<span class="beyond_consumo_titulo">Consumo Beyond</span>
|
||||
<div class="beyond_consumo_rejilla">
|
||||
<div class="beyond_dato">
|
||||
<span class="beyond_dato_etiqueta">Última visita</span>
|
||||
<field name="beyond_last_visit" nolabel="1" readonly="1"/>
|
||||
</div>
|
||||
<div class="beyond_dato">
|
||||
<span class="beyond_dato_etiqueta">Sucursal habitual</span>
|
||||
<field name="beyond_usual_branch_id" nolabel="1" readonly="1"/>
|
||||
</div>
|
||||
<div class="beyond_dato">
|
||||
<span class="beyond_dato_etiqueta">Ticket promedio</span>
|
||||
<field name="beyond_avg_ticket" nolabel="1" readonly="1"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ══ 3 · Pie ══
|
||||
<!-- ══ 2 · Pie ══
|
||||
Guardar y Descartar explícitos y siempre visibles, el
|
||||
mismo criterio de ADR-012 §6: el icono de nube del
|
||||
panel de control no es evidente y además solo aparece
|
||||
|
||||
Reference in new issue
Block a user