diff --git a/addons/beyond_base/static/src/fields/beyond_form_footer.js b/addons/beyond_base/static/src/fields/beyond_form_footer.js index 662a9ca..56292d2 100644 --- a/addons/beyond_base/static/src/fields/beyond_form_footer.js +++ b/addons/beyond_base/static/src/fields/beyond_form_footer.js @@ -22,6 +22,12 @@ import { standardWidgetProps } from "@web/views/widgets/standard_widget_props"; * DIALOGS (view_button_hook.js checks env.dialogData), and an object button * would save the very changes it is meant to throw away. So both live here, * driven by the record itself. + * + * BOTH GO BACK to where the user came from — the kanban or the list. Staying + * on the form after saving leaves no sign that anything happened: the screen + * does not move and the only feedback was the cloud icon that this widget + * exists to replace. A failed validation is the exception and stays put, with + * the native error, because there the screen SHOULD not move. */ export class BeyondFormFooter extends Component { static template = "beyond_base.FormFooter"; @@ -37,11 +43,16 @@ export class BeyondFormFooter extends Component { } async guardar() { - await this.registro.save(); + // save() devuelve falso cuando la validación no pasa: ahí no se va a + // ninguna parte, para que el error quede a la vista sobre su campo. + if (await this.registro.save()) { + this.env.config.historyBack(); + } } async descartar() { await this.registro.discard(); + this.env.config.historyBack(); } } diff --git a/addons/beyond_base/tests/test_panel_navegador.py b/addons/beyond_base/tests/test_panel_navegador.py index 7585625..0a18efa 100644 --- a/addons/beyond_base/tests/test_panel_navegador.py +++ b/addons/beyond_base/tests/test_panel_navegador.py @@ -115,6 +115,22 @@ class TestPanelEnNavegador(HttpCase): if (!document.querySelector('.beyond_boton_guardar')) { throw new Error('el pie no tiene Guardar explícito'); } + // Se ocultan con CSS, así que siguen en el DOM: lo que se + // afirma es que no se VEN. + const invisible = (sel) => { + const e = document.querySelector(sel); + return !e || getComputedStyle(e).display === 'none'; + }; + if (!invisible('.o_form_button_create')) { + throw new Error('«Nuevo» no va en una ficha: vive en la lista'); + } + if (!invisible('.o_cp_action_menus')) { + throw new Error('el engranaje sigue visible en el panel'); + } + const pildora = document.querySelector('.o_breadcrumb .breadcrumb-item a'); + if (!pildora || getComputedStyle(pildora).borderRadius === '0px') { + throw new Error('la miga no es la píldora de vuelta'); + } // 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'); @@ -126,3 +142,56 @@ class TestPanelEnNavegador(HttpCase): })(); """, "", login='admin', timeout=120) + + def test_guardar_regresa_a_la_lista(self): + """Quedarse en la ficha tras guardar no da señal de que algo pasó: la + pantalla no se mueve. Guardar vuelve a donde se venía, con el registro + ya visible en la kanban.""" + self.browser_js( + "/odoo", + """ + (async () => { + const esperar = (ms) => new Promise(r => setTimeout(r, ms)); + const hasta = async (sel) => { + for (let i = 0; i < 60; i++) { + const e = document.querySelector(sel); + if (e) return e; + await esperar(250); + } + throw new Error('no apareció ' + sel); + }; + (await hasta('[data-menu-xmlid="beyond_branch.menu_beyond_root"]')).click(); + await hasta('.o_kanban_record:not(.o_kanban_ghost)'); + await esperar(500); + const antes = document.querySelectorAll( + '.o_kanban_record:not(.o_kanban_ghost)').length; + + // Alta desde la kanban, que es la puerta del diseño. + (await hasta('.o_control_panel .btn-primary')).click(); + const nombre = await hasta('.beyond_campo_titulo input'); + nombre.value = 'Cliente de prueba del navegador'; + nombre.dispatchEvent(new Event('input', { bubbles: true })); + nombre.dispatchEvent(new Event('change', { bubbles: true })); + await esperar(500); + + (await hasta('.beyond_boton_guardar')).click(); + + // Debe volver a la kanban, y con una tarjeta más. + for (let i = 0; i < 60; i++) { + const kanban = document.querySelector('.o_kanban_renderer'); + if (kanban && !document.querySelector('.beyond_cliente_campos')) { + const ahora = document.querySelectorAll( + '.o_kanban_record:not(.o_kanban_ghost)').length; + if (ahora !== antes + 1) { + throw new Error('volvió a la lista pero hay ' + ahora + + ' tarjetas y antes había ' + antes); + } + console.log('test successful'); + return; + } + await esperar(250); + } + throw new Error('tras guardar seguimos en la ficha'); + })(); + """, + "", login='admin', timeout=120) diff --git a/addons/beyond_branch/static/src/panel/beyond_panel.scss b/addons/beyond_branch/static/src/panel/beyond_panel.scss index 9891646..d9ed4fd 100644 --- a/addons/beyond_branch/static/src/panel/beyond_panel.scss +++ b/addons/beyond_branch/static/src/panel/beyond_panel.scss @@ -224,6 +224,65 @@ body.beyond_panel { color: $beyond-ink; } + // ── Engranaje ───────────────────────────────────────────────────────── + // El menú de acciones (archivar, duplicar, eliminar) sale de TODAS las + // vistas del panel por decisión del cliente (25-ago-2026). Solo aquí + // dentro: fuera del panel la cuenta técnica lo conserva, que es donde se + // archiva y se duplica de verdad. + .o_cp_action_menus { display: none !important; } + + // ── Encabezado de una ficha ─────────────────────────────────────────── + // El panel de control nativo se reviste; no se sustituye. La miga ya viene + // apilada (el contenedor es flex-md-column): arriba el camino y abajo el + // nombre del registro. Lo que cambia es cómo se ven. + .o_form_view { + // «Nuevo» no va en una ficha: vive en la kanban y en la lista. + .o_form_button_create { display: none !important; } + + // El camino de vuelta, como píldora gris con su flecha. + .o_breadcrumb .breadcrumb { + margin: 0; + + .breadcrumb-item { + padding: 0; + + &::before { content: none; } // el separador «/» de Bootstrap + + > a { + display: inline-flex; + align-items: center; + padding: 11px 22px; + border-radius: 999px; + background: $beyond-surface-hover; + color: $beyond-ink; + font-size: 14px; + font-weight: 800; + text-decoration: none; + white-space: nowrap; + transition: background 140ms ease; + + &::before { content: "←"; margin-right: 8px; } + &:hover { background: $beyond-surface-active; } + } + } + } + + // El nombre del registro, en grande. + .o_last_breadcrumb_item { + font-size: 18px; + font-weight: 800; + letter-spacing: -0.01em; + color: $beyond-ink; + } + + // La miga y el título uno al lado del otro, como el diseño. + .o_breadcrumb { + flex-direction: row !important; + align-items: center; + gap: 16px; + } + } + // ── Buscador y sus chips (los facets nativos) ───────────────────────── // Los filtros y agrupaciones de cada search view SE CONSERVAN: son los // que Odoo ya sabe aplicar. Lo único que cambia es cómo se ven. diff --git a/addons/beyond_customer/static/src/clientes.scss b/addons/beyond_customer/static/src/clientes.scss index 1515b61..5943921 100644 --- a/addons/beyond_customer/static/src/clientes.scss +++ b/addons/beyond_customer/static/src/clientes.scss @@ -104,6 +104,27 @@ body.beyond_panel { } } + // El rótulo de sección sobre el nombre del registro. Va como literal de + // esta ficha y no leído de la miga porque la miga tiene UN solo elemento + // para el camino de vuelta, y el diseño lo pide dos veces: dentro de la + // píldora y como rótulo. Si la sección se renombra, esto se renombra: son + // cuatro líneas y viven junto a la vista que las usa. + .o_beyond_cliente_form .o_last_breadcrumb_item::before { + content: "Clientes"; + display: block; + font-size: 12px; + font-weight: 800; + letter-spacing: 0.08em; + text-transform: uppercase; + color: $beyond-ink-muted; + } + + .o_beyond_cliente_form .o_last_breadcrumb_item { + flex-direction: column; + align-items: flex-start; + line-height: 1.2; + } + // ══════════════════════════════════════════════════════════════════════ // Ficha del cliente · tres bloques en columna dentro de una tarjeta // ══════════════════════════════════════════════════════════════════════ diff --git a/addons/beyond_customer/tests/test_clientes_vistas.py b/addons/beyond_customer/tests/test_clientes_vistas.py index ca7632c..dced395 100644 --- a/addons/beyond_customer/tests/test_clientes_vistas.py +++ b/addons/beyond_customer/tests/test_clientes_vistas.py @@ -124,6 +124,18 @@ class TestClientesVistas(TransactionCase): self.assertTrue(foto, "la ficha perdió la foto") self.assertEqual(foto[0].get('widget'), 'beyond_image_camera') + def test_la_foto_se_previsualiza_en_grande(self): + """El recuadro mide 250×312 CSS, o sea 500×625 puntos en una pantalla + 2x. Con una variante de 128 la foto se ampliaba casi cinco veces.""" + arch = etree.fromstring(self._arch('beyond_customer.view_beyond_cliente_form')) + foto = arch.xpath("//field[@name='image_1920']")[0] + opciones = foto.get('options') or '' + self.assertIn('image_1024', opciones, + "la previsualización de la foto debe pedir image_1024") + for chico in ('avatar_128', 'image_128', 'image_256'): + 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.""" arch = etree.fromstring(self._arch('beyond_customer.view_beyond_cliente_form')) diff --git a/addons/beyond_customer/views/res_partner_views.xml b/addons/beyond_customer/views/res_partner_views.xml index 36e8527..5a1b01a 100644 --- a/addons/beyond_customer/views/res_partner_views.xml +++ b/addons/beyond_customer/views/res_partner_views.xml @@ -170,8 +170,14 @@