Resucita el widget de la foto y corrige el revestimiento de Clientes
El menú de la foto no aparecía nunca: el contenedor llevaba overflow:hidden para redondear la imagen y el menú cuelga de su borde inferior con top:100%, así que se renderizaba recortado. Las tres opciones estaban en el DOM y eran inalcanzables. El redondeo lo hace ahora cada hijo por su cuenta. Detrás había dos defectos más que nadie podía ver desde la interfaz porque el primero tapaba el camino. useExternalListener se importaba de @web/core/utils/hooks, donde no existe: el diálogo de la cámara reventaba al renderizar con un error opaco de OWL, siempre, también en producción. Y alternarMenu hacía «abierto = fijado || abierto», que nunca cierra: en tablet, donde no hay mouse que sacar, el menú se quedaba pegado. Los tres los cazó el navegador. Dockerfile.test agrega Chromium a la MISMA imagen fijada por digest que producción, y pruebas.sh corre la suite ahí dentro: sin navegador, Odoo SALTA las pruebas de JavaScript y reporta verde, que es como un widget muerto convivió con la suite en verde. Un test propio ejecuta las unitarias de beyond_base sin arrastrar las ~3700 del core. Doce unitarias cubren el menú, la degradación sin cámara, la trasera por defecto, el cambio de cámara y la liberación del stream al cerrar y con Escape; una de ellas afirma que nadie recorta el menú, porque contar elementos no detectaba el defecto: el nodo estaba ahí. Del revestimiento: las notas dejan de mostrar las etiquetas HTML en crudo, la ficha ocupa el ancho completo —la segunda columna quedó vacía al irse RFC, sitio, categorías e idioma—, ciudad y estado se leen uno bajo otro, y Anonimizar baja del <header> al pie, junto a Guardar y Descartar y como acción secundaria: en la franja de estados parecía la acción principal. Las iniciales colapsaban a una franja porque el envoltorio de Odoo no tiene altura propia, y el tamaño en em se resolvía contra la tipografía heredada. Las tarjetas fantasma eran las que Odoo mete para cuadrar la retícula, a las que el revestimiento pintaba fondo y borde. En datos demo: los avatares de colores no eran iniciales sino monogramas guardados COMO foto; se repintan en la paleta del panel. Los usuarios demo heredaban la foto del usuario plantilla y por eso la barra nunca mostraba el avatar naranja. Y el cliente con foto usa ahora una ilustración propia en vez de la imagen de una empleada. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
No files matched your search
@@ -0,0 +1,55 @@
|
||||
# Imagen de PRUEBAS de Beyond.
|
||||
#
|
||||
# The only thing it adds to the runtime image is a browser. Odoo runs its
|
||||
# JavaScript suites — hoot unit tests AND tours — through browser_js, which
|
||||
# drives a real Chrome in headless mode. Without one, `--test-enable` SKIPS
|
||||
# them silently, and a widget can be dead in the interface while every test
|
||||
# passes. That is not hypothetical: it happened, with the photo menu of
|
||||
# beyond_image_camera.
|
||||
#
|
||||
# NOT the production image and NOT the dev compose: a third artifact, used by
|
||||
# scripts/pruebas.sh and by the CI still pending in docs/despliegue.md.
|
||||
# Producción no lleva navegador.
|
||||
FROM odoo:19@sha256:84d09c623fc78050c2195161b98897995ba68c87aa4212d0ec0f4f3ce88c7610
|
||||
|
||||
USER root
|
||||
|
||||
# Chromium de Playwright, fijado por versión de playwright. Tres candidatos
|
||||
# quedaron descartados por motivos concretos:
|
||||
# · Ubuntu `chromium` / `chromium-browser` en noble es un paquete de
|
||||
# transición a snap (2:1snap1) que no se instala en un contenedor.
|
||||
# · Chrome for Testing publica SOLO linux64 (x86-64), y las máquinas de
|
||||
# desarrollo del proyecto son arm64: no arranca ni con emulación cómoda.
|
||||
# · El repositorio apt de Google sirve siempre «la última», así que la
|
||||
# versión no se puede fijar.
|
||||
# Playwright publica builds de Chromium para arm64 y amd64 bajo la misma
|
||||
# versión, así que ESTE MISMO Dockerfile produce el mismo navegador en la
|
||||
# máquina de desarrollo y en la CI. Se sube a propósito, como el digest.
|
||||
ARG PLAYWRIGHT_VERSION=1.56.0
|
||||
ENV PLAYWRIGHT_BROWSERS_PATH=/opt/navegador
|
||||
|
||||
# python3-websocket: sin él Odoo SALTA las pruebas de navegador en vez de
|
||||
# fallar — el verde silencioso que este archivo existe para eliminar.
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
python3-websocket python3-pip \
|
||||
ca-certificates fonts-liberation \
|
||||
libnss3 libnspr4 libdbus-1-3 libatk1.0-0t64 libatk-bridge2.0-0t64 \
|
||||
libcups2t64 libdrm2 libxkbcommon0 libxcomposite1 libxdamage1 \
|
||||
libxfixes3 libxrandr2 libgbm1 libxshmfence1 libasound2t64 \
|
||||
libpango-1.0-0 libcairo2 libatspi2.0-0t64 \
|
||||
&& pip3 install --no-cache-dir --break-system-packages \
|
||||
"playwright==${PLAYWRIGHT_VERSION}" \
|
||||
&& python3 -m playwright install chromium \
|
||||
&& pip3 uninstall -y --break-system-packages playwright \
|
||||
&& apt-get purge -y python3-pip \
|
||||
&& apt-get autoremove -y \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& chmod -R a+rX /opt/navegador
|
||||
|
||||
# Odoo busca el ejecutable por nombre en PATH: google-chrome, chromium,
|
||||
# chromium-browser o google-chrome-stable (odoo/tests/common.py).
|
||||
RUN ln -sf "$(find /opt/navegador -name chrome -type f | head -1)" \
|
||||
/usr/local/bin/google-chrome
|
||||
|
||||
USER odoo
|
||||
@@ -1,8 +1,11 @@
|
||||
/** Part of Beyond. Collina Systems proprietary module. */
|
||||
import { Component, onWillUnmount, useRef, useState } from "@odoo/owl";
|
||||
import { Component, onWillUnmount, useExternalListener, useRef, useState } from "@odoo/owl";
|
||||
import { Dialog } from "@web/core/dialog/dialog";
|
||||
import { registry } from "@web/core/registry";
|
||||
import { useService, useExternalListener } from "@web/core/utils/hooks";
|
||||
// useExternalListener viene de OWL, NO de @web/core/utils/hooks: importarlo
|
||||
// de ahí devuelve undefined y el diálogo de la cámara revienta al renderizar,
|
||||
// sin decir por qué. Lo cazaron las unitarias en navegador.
|
||||
import { useService } from "@web/core/utils/hooks";
|
||||
import { browser } from "@web/core/browser/browser";
|
||||
import { _t } from "@web/core/l10n/translation";
|
||||
import { ImageField, imageField } from "@web/views/fields/image/image_field";
|
||||
@@ -183,10 +186,17 @@ export class BeyondImageCamera extends ImageField {
|
||||
}
|
||||
}
|
||||
|
||||
/** Touch has no hover: a tap pins the menu open, another closes it. */
|
||||
/**
|
||||
* Touch has no hover: a tap pins the menu open, another closes it.
|
||||
*
|
||||
* The second tap has to actually close it. `abierto = fijado || abierto`
|
||||
* looked harmless and was not: once open, the right-hand side kept it
|
||||
* open for ever and the menu could only be dismissed by moving a mouse
|
||||
* the tablet does not have.
|
||||
*/
|
||||
alternarMenu() {
|
||||
this.menu.fijado = !this.menu.fijado;
|
||||
this.menu.abierto = this.menu.fijado || this.menu.abierto;
|
||||
this.menu.abierto = this.menu.fijado;
|
||||
}
|
||||
|
||||
cerrarMenu() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** Part of Beyond. Collina Systems proprietary module. */
|
||||
import { expect, test, describe } from "@odoo/hoot";
|
||||
import { click, queryAll, queryFirst } from "@odoo/hoot-dom";
|
||||
import { click, press, queryAll, queryFirst } from "@odoo/hoot-dom";
|
||||
import { animationFrame } from "@odoo/hoot-mock";
|
||||
import {
|
||||
defineModels,
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
patchWithCleanup,
|
||||
} from "@web/../tests/web_test_helpers";
|
||||
import { browser } from "@web/core/browser/browser";
|
||||
import { defineMailModels } from "@mail/../tests/mail_test_helpers";
|
||||
|
||||
/**
|
||||
* Unit tests for beyond_image_camera.
|
||||
@@ -23,8 +24,11 @@ import { browser } from "@web/core/browser/browser";
|
||||
|
||||
describe.current.tags("desktop");
|
||||
|
||||
class ResPartner extends models.Model {
|
||||
_name = "res.partner";
|
||||
// Un modelo propio y NO res.partner: montar una vista sobre res.partner
|
||||
// arrastra la maquinaria de mail (el chatter pide discuss.channel) y las
|
||||
// pruebas mueren antes de llegar al widget. Al widget el modelo le da igual.
|
||||
class BeyondFoto extends models.Model {
|
||||
_name = "beyond.foto";
|
||||
|
||||
name = fields.Char();
|
||||
image_1920 = fields.Binary();
|
||||
@@ -32,22 +36,47 @@ class ResPartner extends models.Model {
|
||||
_records = [{ id: 1, name: "Alejandro Mcdonald", image_1920: "FOTO==" }];
|
||||
}
|
||||
|
||||
defineModels([ResPartner]);
|
||||
// Montar CUALQUIER formulario despierta la maquinaria de mail (el chatter
|
||||
// pide discuss.channel) aunque la vista no lo lleve, porque mail parchea la
|
||||
// vista de formulario en el bundle de pruebas. Sin esto, todas las pruebas
|
||||
// mueren antes de llegar al widget.
|
||||
defineMailModels();
|
||||
defineModels([BeyondFoto]);
|
||||
|
||||
const VISTA = /* xml */ `
|
||||
<form>
|
||||
<field name="image_1920" widget="beyond_image_camera"/>
|
||||
</form>`;
|
||||
|
||||
/** Fakes a camera: one track whose stop() we can watch. */
|
||||
/**
|
||||
* Fakes a camera: a REAL MediaStream whose track we can watch.
|
||||
*
|
||||
* It has to be a real one. Assigning a plain object to video.srcObject throws
|
||||
* in Chromium ("the provided value is not of type MediaStream"), which showed
|
||||
* up as an opaque "error in the owl lifecycle" and hid what was really being
|
||||
* tested. A canvas gives us a genuine stream with a genuine track.
|
||||
*/
|
||||
function camaraFalsa({ camaras = 1 } = {}) {
|
||||
const pista = { stop: () => (pista.detenida = true), detenida: false, kind: "video" };
|
||||
const stream = { getTracks: () => [pista] };
|
||||
const lienzo = document.createElement("canvas");
|
||||
lienzo.width = 4;
|
||||
lienzo.height = 4;
|
||||
const stream = lienzo.captureStream();
|
||||
const pista = stream.getVideoTracks()[0];
|
||||
pista.detenida = false;
|
||||
const detenerReal = pista.stop.bind(pista);
|
||||
pista.stop = () => {
|
||||
pista.detenida = true;
|
||||
detenerReal();
|
||||
};
|
||||
pista.peticiones = [];
|
||||
patchWithCleanup(browser, {
|
||||
navigator: {
|
||||
...browser.navigator,
|
||||
mediaDevices: {
|
||||
getUserMedia: async () => stream,
|
||||
getUserMedia: async (restricciones) => {
|
||||
pista.peticiones.push(restricciones?.video?.facingMode);
|
||||
return stream;
|
||||
},
|
||||
enumerateDevices: async () =>
|
||||
Array.from({ length: camaras }, () => ({ kind: "videoinput" })),
|
||||
},
|
||||
@@ -65,7 +94,7 @@ function sinCamara() {
|
||||
|
||||
test("el menú de la foto se abre al pasar el mouse y se cierra al salir", async () => {
|
||||
camaraFalsa();
|
||||
await mountView({ type: "form", resModel: "res.partner", resId: 1, arch: VISTA });
|
||||
await mountView({ type: "form", resModel: "beyond.foto", resId: 1, arch: VISTA });
|
||||
|
||||
expect(".beyond_foto_menu").toHaveCount(0);
|
||||
|
||||
@@ -78,9 +107,43 @@ test("el menú de la foto se abre al pasar el mouse y se cierra al salir", async
|
||||
expect(".beyond_foto_menu").toHaveCount(0);
|
||||
});
|
||||
|
||||
test("el contenedor de la foto no recorta el menú", async () => {
|
||||
// ESTA es la prueba que faltaba. El menú se renderizaba —el t-if pasaba y
|
||||
// el DOM lo tenía— pero el contenedor llevaba overflow:hidden para
|
||||
// redondear la imagen, y el menú cuelga por debajo con top:100%: quedaba
|
||||
// recortado y era inalcanzable. Contar elementos no lo detecta, porque el
|
||||
// nodo está ahí; ni :visible, porque un elemento recortado conserva su
|
||||
// tamaño. Lo que hay que afirmar es que nadie lo recorta.
|
||||
camaraFalsa();
|
||||
await mountView({ type: "form", resModel: "beyond.foto", resId: 1, arch: VISTA });
|
||||
|
||||
await click(".beyond_foto");
|
||||
await animationFrame();
|
||||
|
||||
const menu = queryFirst(".beyond_foto_menu");
|
||||
expect(menu).not.toBe(null);
|
||||
// Solo hasta la hoja del formulario: de ahí para arriba el cliente web
|
||||
// recorta a propósito (.o_form_view y .o_action_manager son sus
|
||||
// contenedores de desplazamiento). Lo que no puede recortar es el propio
|
||||
// widget, que es donde estaba el defecto.
|
||||
// Solo los dos nodos que este widget controla. De ahí para arriba el
|
||||
// cliente web recorta a propósito: .o_form_view y .o_action_manager son
|
||||
// sus contenedores de desplazamiento y siempre llevan overflow:hidden.
|
||||
for (const selector of [".beyond_foto", ".o_field_widget[name=image_1920]"]) {
|
||||
const nodo = queryFirst(selector);
|
||||
if (!nodo) {
|
||||
continue;
|
||||
}
|
||||
const estilo = getComputedStyle(nodo);
|
||||
expect(`${estilo.overflow} ${estilo.overflowY}`).not.toInclude("hidden", {
|
||||
message: `${selector} recorta el menú de la foto`,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
test("un toque fija el menú y otro lo suelta (en táctil no hay hover)", async () => {
|
||||
camaraFalsa();
|
||||
await mountView({ type: "form", resModel: "res.partner", resId: 1, arch: VISTA });
|
||||
await mountView({ type: "form", resModel: "beyond.foto", resId: 1, arch: VISTA });
|
||||
|
||||
await click(".beyond_foto");
|
||||
await animationFrame();
|
||||
@@ -100,7 +163,7 @@ test("sin cámara no se ofrece «Tomar fotografía», y sí «Subir archivo»",
|
||||
// Es el caso de las tablets de sucursal mientras producción no tenga TLS:
|
||||
// fuera de contexto seguro el navegador ni siquiera define mediaDevices.
|
||||
sinCamara();
|
||||
await mountView({ type: "form", resModel: "res.partner", resId: 1, arch: VISTA });
|
||||
await mountView({ type: "form", resModel: "beyond.foto", resId: 1, arch: VISTA });
|
||||
|
||||
await click(".beyond_foto");
|
||||
await animationFrame();
|
||||
@@ -112,7 +175,7 @@ test("sin cámara no se ofrece «Tomar fotografía», y sí «Subir archivo»",
|
||||
|
||||
test("con cámara sí se ofrece «Tomar fotografía»", async () => {
|
||||
camaraFalsa();
|
||||
await mountView({ type: "form", resModel: "res.partner", resId: 1, arch: VISTA });
|
||||
await mountView({ type: "form", resModel: "beyond.foto", resId: 1, arch: VISTA });
|
||||
|
||||
await click(".beyond_foto");
|
||||
await animationFrame();
|
||||
@@ -125,7 +188,7 @@ test("«Subir archivo» pide la cámara trasera, no la frontal", async () => {
|
||||
// Coherencia con el diálogo propio: el caso de uso es el mostrador
|
||||
// fotografiando al cliente, no una selfie.
|
||||
sinCamara();
|
||||
await mountView({ type: "form", resModel: "res.partner", resId: 1, arch: VISTA });
|
||||
await mountView({ type: "form", resModel: "beyond.foto", resId: 1, arch: VISTA });
|
||||
|
||||
await click(".beyond_foto");
|
||||
await animationFrame();
|
||||
@@ -135,7 +198,7 @@ test("«Subir archivo» pide la cámara trasera, no la frontal", async () => {
|
||||
|
||||
test("«Eliminar» limpia el campo", async () => {
|
||||
camaraFalsa();
|
||||
await mountView({ type: "form", resModel: "res.partner", resId: 1, arch: VISTA });
|
||||
await mountView({ type: "form", resModel: "beyond.foto", resId: 1, arch: VISTA });
|
||||
|
||||
await click(".beyond_foto");
|
||||
await animationFrame();
|
||||
@@ -150,7 +213,7 @@ test("cerrar el diálogo apaga la cámara", async () => {
|
||||
// Una cámara que se queda encendida deja el testigo del aparato prendido
|
||||
// y parece que el local está grabando.
|
||||
const pista = camaraFalsa();
|
||||
await mountView({ type: "form", resModel: "res.partner", resId: 1, arch: VISTA });
|
||||
await mountView({ type: "form", resModel: "beyond.foto", resId: 1, arch: VISTA });
|
||||
|
||||
await click(".beyond_foto");
|
||||
await animationFrame();
|
||||
@@ -160,7 +223,7 @@ test("cerrar el diálogo apaga la cámara", async () => {
|
||||
expect(".beyond_camara_video").toHaveCount(1);
|
||||
expect(pista.detenida).toBe(false);
|
||||
|
||||
await click(".beyond_camara_dialogo .btn-secondary:last-child"); // Cancelar
|
||||
await click(".beyond_camara_dialogo .modal-footer button:contains(Cancelar)");
|
||||
await animationFrame();
|
||||
|
||||
expect(pista.detenida).toBe(true);
|
||||
@@ -168,7 +231,7 @@ test("cerrar el diálogo apaga la cámara", async () => {
|
||||
|
||||
test("con una sola cámara no se ofrece cambiarla", async () => {
|
||||
camaraFalsa({ camaras: 1 });
|
||||
await mountView({ type: "form", resModel: "res.partner", resId: 1, arch: VISTA });
|
||||
await mountView({ type: "form", resModel: "beyond.foto", resId: 1, arch: VISTA });
|
||||
|
||||
await click(".beyond_foto");
|
||||
await animationFrame();
|
||||
@@ -181,3 +244,55 @@ test("con una sola cámara no se ofrece cambiarla", async () => {
|
||||
);
|
||||
expect(botones).not.toInclude("Cambiar de cámara");
|
||||
});
|
||||
|
||||
|
||||
test("el diálogo pide la cámara TRASERA por defecto", async () => {
|
||||
// El caso de uso es el mostrador retratando al cliente, no una selfie.
|
||||
const pista = camaraFalsa();
|
||||
await mountView({ type: "form", resModel: "beyond.foto", resId: 1, arch: VISTA });
|
||||
|
||||
await click(".beyond_foto");
|
||||
await animationFrame();
|
||||
await click(".beyond_foto_opcion");
|
||||
await animationFrame();
|
||||
await animationFrame();
|
||||
|
||||
expect(pista.peticiones[0]).toBe("environment");
|
||||
});
|
||||
|
||||
test("el botón de cambio pasa a la cámara frontal", async () => {
|
||||
const pista = camaraFalsa({ camaras: 2 });
|
||||
await mountView({ type: "form", resModel: "beyond.foto", resId: 1, arch: VISTA });
|
||||
|
||||
await click(".beyond_foto");
|
||||
await animationFrame();
|
||||
await click(".beyond_foto_opcion");
|
||||
await animationFrame();
|
||||
await animationFrame();
|
||||
|
||||
await click(".beyond_camara_dialogo .modal-footer button:contains(Cambiar)");
|
||||
await animationFrame();
|
||||
await animationFrame();
|
||||
|
||||
expect(pista.peticiones).toEqual(["environment", "user"]);
|
||||
});
|
||||
|
||||
test("cerrar con Escape también apaga la cámara", async () => {
|
||||
// Cerrar con el teclado es la salida que más se olvida, y una cámara
|
||||
// encendida deja el testigo del aparato prendido.
|
||||
const pista = camaraFalsa();
|
||||
await mountView({ type: "form", resModel: "beyond.foto", resId: 1, arch: VISTA });
|
||||
|
||||
await click(".beyond_foto");
|
||||
await animationFrame();
|
||||
await click(".beyond_foto_opcion");
|
||||
await animationFrame();
|
||||
await animationFrame();
|
||||
expect(".beyond_camara_video").toHaveCount(1);
|
||||
|
||||
await press("Escape");
|
||||
await animationFrame();
|
||||
|
||||
expect(".beyond_camara_dialogo").toHaveCount(0);
|
||||
expect(pista.detenida).toBe(true);
|
||||
});
|
||||
@@ -4,3 +4,4 @@ from . import test_menu_cleanup
|
||||
from . import test_security_groups
|
||||
from . import test_signup
|
||||
from . import test_panel_navbar
|
||||
from . import test_unitarias_js
|
||||
@@ -0,0 +1,32 @@
|
||||
# Part of Beyond. Collina Systems proprietary module.
|
||||
from odoo.tests import HttpCase, tagged
|
||||
|
||||
from odoo.addons.web.tests.test_js import unit_test_error_checker
|
||||
|
||||
# Hoot identifica cada suite por un hash de su ruta. El de «@beyond_base»
|
||||
# selecciona todas las unitarias de este módulo y ninguna ajena, para no
|
||||
# arrastrar las ~3700 del core en cada corrida. El algoritmo es el de
|
||||
# web/tests/test_js.py::HOOTCommon._generate_hash; si algún día cambia, este
|
||||
# test empieza a correr de más, no de menos.
|
||||
SUITE_BEYOND = 'd6e526c1' # @beyond_base
|
||||
|
||||
|
||||
@tagged('post_install', '-at_install')
|
||||
class TestBeyondUnitariasJS(HttpCase):
|
||||
"""Corre las unitarias JS de beyond_base en un navegador de verdad.
|
||||
|
||||
Existe porque el runner de hoot vive en el módulo `web`: acotar la suite
|
||||
con --test-tags=/beyond_base lo deja fuera, y entonces las unitarias no se
|
||||
ejecutan y la corrida sale verde sin haberlas mirado. Eso ya nos pasó: el
|
||||
menú de la foto estaba muerto en la interfaz con todas las pruebas en
|
||||
verde.
|
||||
"""
|
||||
|
||||
def test_unitarias_de_beyond(self):
|
||||
self.browser_js(
|
||||
f'/web/tests?headless&loglevel=2&preset=desktop&timeout=15000'
|
||||
f'&id={SUITE_BEYOND}',
|
||||
"", "", login='admin', timeout=1800,
|
||||
success_signal="[HOOT] Test suite succeeded",
|
||||
error_checker=unit_test_error_checker,
|
||||
)
|
||||
@@ -30,6 +30,7 @@
|
||||
<field name="password">beyond-demo-2026</field>
|
||||
<field name="group_ids" eval="[(6, 0, [ref('beyond_base.beyond_group_admin_sucursal')])]"/>
|
||||
<field name="branch_ids" eval="[(6, 0, [ref('demo_branch_centro')])]"/>
|
||||
<field name="image_1920" eval="False"/>
|
||||
</record>
|
||||
|
||||
<!-- C-007: cuenta de Administrador general SIN group_system, para
|
||||
@@ -40,6 +41,11 @@
|
||||
<field name="login">direccion@beyond.example</field>
|
||||
<field name="password">beyond-demo-2026</field>
|
||||
<field name="group_ids" eval="[(6, 0, [ref('beyond_base.beyond_group_admin_general')])]"/>
|
||||
<!-- Sin foto: Odoo copia la del usuario plantilla al crear una cuenta,
|
||||
y esa foto es un monograma de su propia paleta. La barra del panel
|
||||
muestra la foto cuando existe (así lo pide el diseño), así que con
|
||||
ella heredada nunca se veía el avatar naranja con la inicial. -->
|
||||
<field name="image_1920" eval="False"/>
|
||||
</record>
|
||||
|
||||
<!-- Tercera cuenta: el rol Empleado. Faltaba, y sin ella no se puede
|
||||
@@ -52,5 +58,6 @@
|
||||
<field name="password">beyond-demo-2026</field>
|
||||
<field name="group_ids" eval="[(6, 0, [ref('beyond_base.beyond_group_empleado')])]"/>
|
||||
<field name="branch_ids" eval="[(6, 0, [ref('demo_branch_centro')])]"/>
|
||||
<field name="image_1920" eval="False"/>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -21,15 +21,20 @@ body.beyond_panel {
|
||||
width: 100%;
|
||||
aspect-ratio: 4 / 5; // el retrato del diseño, no un cuadrado
|
||||
border-radius: 26px;
|
||||
overflow: hidden;
|
||||
background: $beyond-panel-durazno;
|
||||
cursor: pointer;
|
||||
|
||||
// SIN overflow:hidden. Estuvo aquí para redondear la imagen y se
|
||||
// llevaba por delante el menú, que cuelga del borde inferior con
|
||||
// top:100%: el desplegable se renderizaba y quedaba recortado, o sea
|
||||
// invisible e inalcanzable, con las tres opciones muertas. El
|
||||
// redondeo lo hace ahora cada hijo por su cuenta.
|
||||
.beyond_foto_img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
display: block;
|
||||
border-radius: inherit;
|
||||
}
|
||||
|
||||
.beyond_foto_velo {
|
||||
@@ -39,6 +44,7 @@ body.beyond_panel {
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: rgba(35, 32, 29, 0.5);
|
||||
border-radius: inherit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +52,8 @@ body.beyond_panel {
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
z-index: 30;
|
||||
// Por encima de la hoja del formulario, que crea su propio contexto.
|
||||
z-index: 1051;
|
||||
min-width: 208px;
|
||||
margin-top: 8px;
|
||||
padding: 6px;
|
||||
@@ -88,6 +95,19 @@ body.beyond_panel {
|
||||
// ── Foto o iniciales ──────────────────────────────────────────────────
|
||||
// The size comes from wherever it is used (kanban card, list row), so
|
||||
// that one widget serves the 92px card and the 38px row.
|
||||
// El widget viaja dentro del envoltorio .o_field_widget de Odoo, que no
|
||||
// tiene altura propia: sin esto, un height:100% se resolvía contra un
|
||||
// padre de altura automática y las iniciales colapsaban a una franja de
|
||||
// pocos píxeles. Con <img> no se notaba, porque la imagen trae altura
|
||||
// intrínseca.
|
||||
.o_field_beyond_avatar_initials,
|
||||
.o_field_widget:has(> .beyond_avatar_iniciales),
|
||||
.o_field_widget:has(> .beyond_avatar_img) {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.beyond_avatar_img,
|
||||
.beyond_avatar_iniciales {
|
||||
width: 100%;
|
||||
@@ -106,9 +126,9 @@ body.beyond_panel {
|
||||
color: $beyond-panel-acento-pressed;
|
||||
font-weight: 800;
|
||||
letter-spacing: -0.01em;
|
||||
// Scales with the box it is given: 92px card → 28px letters,
|
||||
// 38px row → 13px, which is what the design draws.
|
||||
font-size: 0.32em;
|
||||
// Tamaño explícito por contexto: em se resolvía contra la tipografía
|
||||
// heredada, no contra el cuadro, y salían letras diminutas.
|
||||
font-size: 28px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -392,7 +392,11 @@ body.beyond_panel {
|
||||
// ══════════════════════════════════════════════════════════════════════
|
||||
.o_kanban_renderer { padding: 10px 22px 28px; gap: 14px; background: $beyond-surface; }
|
||||
|
||||
.o_kanban_record {
|
||||
// :not(.o_kanban_ghost) NO es decorativo. Odoo mete tarjetas fantasma
|
||||
// vacías al final de la retícula para que la última fila no se estire, y
|
||||
// sin excluirlas el revestimiento les pinta fondo blanco y borde: se ven
|
||||
// como tarjetas de cliente vacías, una suelta y una fila entera al final.
|
||||
.o_kanban_record:not(.o_kanban_ghost) {
|
||||
padding: 18px 20px;
|
||||
background: #FFFFFF;
|
||||
border: 1px solid $beyond-surface-active;
|
||||
@@ -520,7 +524,7 @@ body.beyond_panel {
|
||||
// página entera se mueva en horizontal.
|
||||
.o_list_renderer { overflow-x: auto; }
|
||||
|
||||
.o_kanban_renderer .o_kanban_record { width: 100%; }
|
||||
.o_kanban_renderer .o_kanban_record:not(.o_kanban_ghost) { width: 100%; }
|
||||
}
|
||||
|
||||
// Touch: los controles de acción suben al mínimo táctil. Se aplica por
|
||||
|
||||
@@ -13,9 +13,13 @@
|
||||
Las cuatro cumplen el dominio de la acción —persona, sin usuario y
|
||||
sin empleado (C-018)—, que es justo lo que las hace aparecer.
|
||||
|
||||
La foto es la de una empleada demo reutilizada: es un retrato ficticio
|
||||
que ya vive en el repo y evita agregar un binario nuevo solo para
|
||||
esto. Si alguna vez estorba en una demo, se quita el atributo.
|
||||
La foto de Alejandro es una ILUSTRACIÓN, no una persona: un marcador
|
||||
plano en la paleta del panel, para poder demostrar el caso «cliente
|
||||
con foto» sin inventar el retrato de nadie. Antes aquí se reutilizaba
|
||||
la imagen de una empleada demo, que resultó ser un monograma «DT»
|
||||
sobre verde oliva y en la ficha ocupaba el recuadro 4:5 entero.
|
||||
Cuando el cliente entregue retratos de verdad, se sustituye el
|
||||
archivo y nada más.
|
||||
-->
|
||||
<record id="demo_cliente_alejandro" model="res.partner">
|
||||
<field name="name">Alejandro Mcdonald</field>
|
||||
@@ -23,7 +27,7 @@
|
||||
<field name="street">Av. Juárez 1820, La Paz</field>
|
||||
<field name="city">Puebla</field>
|
||||
<field name="comment">Prefiere cita temprano. Alérgico al amoniaco.</field>
|
||||
<field name="image_1920" type="base64" file="beyond_base/static/demo/empleada_daniela.png"/>
|
||||
<field name="image_1920" type="base64" file="beyond_customer/static/demo/cliente_retrato.png"/>
|
||||
</record>
|
||||
|
||||
<record id="demo_cliente_marisol" model="res.partner">
|
||||
@@ -60,10 +64,12 @@
|
||||
OJO al revisar: esto corre al INSTALAR, no al actualizar. Los archivos
|
||||
demo se cargan con semántica noupdate y convert.py salta los <function>
|
||||
cuando el modo no es «init», así que una base que ya existía (como
|
||||
beyond_dev) no se limpia con -u; hay que llamarlo una vez a mano:
|
||||
beyond_dev) no se limpia sola con una actualización. Para limpiarla una
|
||||
vez, desde el shell de Odoo:
|
||||
|
||||
env['res.partner']._beyond_demo_limpiar_contactos_hijos()
|
||||
env.cr.commit()
|
||||
|
||||
docker compose exec odoo odoo shell -d beyond_dev --no-http \
|
||||
<<< "env['res.partner']._beyond_demo_limpiar_contactos_hijos(); env.cr.commit()"
|
||||
-->
|
||||
<function model="res.partner" name="_beyond_demo_limpiar_contactos_hijos"/>
|
||||
</odoo>
|
||||
|
After Width: | Height: | Size: 2.9 KiB |
@@ -112,9 +112,38 @@ body.beyond_panel {
|
||||
max-width: 40%;
|
||||
}
|
||||
|
||||
// Notas: un renglón que crece hasta 132px y luego se desplaza dentro,
|
||||
// para que la ficha no se estire sin límite y el resto no se mueva.
|
||||
// ── Ancho de la ficha ─────────────────────────────────────────────────
|
||||
// El formulario nativo reparte sus grupos en dos columnas. Con la segunda
|
||||
// vacía —se fueron RFC, sitio, categorías e idioma— la ficha se quedaba
|
||||
// usando la mitad izquierda de la pantalla y la derecha en blanco. Cada
|
||||
// grupo pasa a ocupar el ancho completo y se apilan.
|
||||
.o_form_view .o_form_sheet > .o_group > .o_inner_group {
|
||||
grid-column: 1 / -1;
|
||||
|
||||
// La columna que quedó sin campos no debe dejar un hueco vertical.
|
||||
&:empty { display: none; }
|
||||
}
|
||||
|
||||
// El bloque de dirección nativo mete ciudad y estado en el mismo renglón.
|
||||
// El diseño los lee uno debajo de otro, cada uno con su marcador.
|
||||
.o_address_format {
|
||||
display: block;
|
||||
|
||||
> .o_address_street,
|
||||
> .o_address_city,
|
||||
> .o_address_state,
|
||||
> .o_wrap_field {
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
// Notas: crecen hasta 132px y luego se desplazan dentro, para que la ficha
|
||||
// no se estire sin límite y el resto no se mueva. Es un campo HTML, así
|
||||
// que el editable es un div, no un textarea.
|
||||
.beyond_cliente_notas {
|
||||
.odoo-editor-editable,
|
||||
.o_field_html > div,
|
||||
textarea {
|
||||
min-height: 22px;
|
||||
max-height: 132px;
|
||||
@@ -124,6 +153,34 @@ body.beyond_panel {
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
// Sin márgenes de párrafo: el diseño es un renglón que crece, no un
|
||||
// documento.
|
||||
.odoo-editor-editable p { margin: 0; }
|
||||
}
|
||||
|
||||
// ── Pie de acciones ───────────────────────────────────────────────────
|
||||
.beyond_cliente_acciones {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-top: 26px;
|
||||
padding-top: 14px;
|
||||
border-top: 1.5px solid $beyond-surface-hover;
|
||||
}
|
||||
|
||||
// Destructivo pero secundario: es la acción menos frecuente de la ficha y
|
||||
// no debe competir con Guardar. Contorno, no relleno.
|
||||
.beyond_boton_destructivo.btn,
|
||||
.beyond_boton_destructivo.btn-secondary {
|
||||
background: transparent;
|
||||
border: 1.5px solid $beyond-panel-rojo;
|
||||
color: $beyond-panel-rojo;
|
||||
font-size: 13px;
|
||||
|
||||
&:hover, &:focus-visible {
|
||||
background: $beyond-panel-rojo-suave;
|
||||
color: $beyond-panel-rojo;
|
||||
}
|
||||
}
|
||||
|
||||
// ── Responsivo ────────────────────────────────────────────────────────
|
||||
|
||||
@@ -169,6 +169,31 @@ class TestClientesVistas(TransactionCase):
|
||||
with self.assertRaises(AccessError):
|
||||
self.cliente.with_user(gerente).action_beyond_anonymize()
|
||||
|
||||
def test_las_notas_no_son_texto_plano(self):
|
||||
"""comment es un campo HTML: con widget="text" se leían las etiquetas
|
||||
en crudo, «<p>Prefiere cita temprano.</p>»."""
|
||||
arch = etree.fromstring(self._arch('beyond_customer.view_beyond_cliente_form'))
|
||||
notas = arch.xpath("//field[@name='comment']")
|
||||
self.assertTrue(notas, "la ficha perdió las notas")
|
||||
self.assertIsNone(
|
||||
notas[0].get('widget'),
|
||||
"las notas deben usar el widget propio de un campo HTML")
|
||||
|
||||
def test_anonimizar_va_en_el_pie_y_es_secundario(self):
|
||||
"""En el <header> quedaba solo y enorme bajo el encabezado, como si
|
||||
fuera la acción principal de la pantalla. Va al pie, con Guardar y
|
||||
Descartar, y como acción secundaria."""
|
||||
arch = etree.fromstring(self._arch('beyond_customer.view_beyond_cliente_form'))
|
||||
self.assertFalse(
|
||||
arch.xpath("//header//button[@name='action_beyond_anonymize']"),
|
||||
"anonimizar sigue en la franja de estados")
|
||||
boton = arch.xpath(
|
||||
"//div[@class='beyond_cliente_acciones']"
|
||||
"/button[@name='action_beyond_anonymize']")
|
||||
self.assertTrue(boton, "anonimizar no está en el pie de la ficha")
|
||||
self.assertIn('btn-secondary', boton[0].get('class'),
|
||||
"anonimizar no debe competir con Guardar")
|
||||
|
||||
# ── La acción y su dominio ───────────────────────────────────────────
|
||||
|
||||
def test_el_dominio_de_clientes_sigue_intacto(self):
|
||||
|
||||
@@ -169,6 +169,10 @@
|
||||
no pertenece a una compañía. -->
|
||||
<xpath expr="//field[@name='company_name']/.." position="replace"/>
|
||||
|
||||
<!-- Sin RFC en la ficha, su campo auxiliar tampoco pinta nada, y
|
||||
era lo único que quedaba en la segunda columna del grupo. -->
|
||||
<field name="partner_vat_placeholder" position="replace"/>
|
||||
|
||||
<!-- El idioma no está en el diseño. Hoy se esconde solo porque hay
|
||||
un idioma activo, pero aparecería en cuanto se agregue otro. -->
|
||||
<field name="lang" position="replace"/>
|
||||
@@ -180,13 +184,14 @@
|
||||
<field name="website" position="replace"/>
|
||||
<field name="category_id" position="replace"/>
|
||||
|
||||
<!-- Notas a la vista, con el alto que crece hasta 132px por SCSS.
|
||||
comment es HTML en el modelo; el widget de texto es el que da
|
||||
el renglón que crece del diseño en vez de un editor. -->
|
||||
<!-- Notas a la vista. SIN widget="text": comment es un campo HTML
|
||||
y el widget de texto pintaba las etiquetas en crudo, «<p>Prefiere
|
||||
cita temprano.</p>». El widget por omisión de un campo HTML es
|
||||
el que lo muestra limpio; el alto que crece hasta 132px lo pone
|
||||
el SCSS. -->
|
||||
<xpath expr="//group[@name='beyond_360']" position="before">
|
||||
<group class="beyond_cliente_notas">
|
||||
<field name="comment" string="Notas" nolabel="1" colspan="2"
|
||||
widget="text"
|
||||
placeholder="Escribe una nota sobre este cliente…"/>
|
||||
</group>
|
||||
</xpath>
|
||||
@@ -218,10 +223,22 @@
|
||||
Contactos nativo conserva el suyo. -->
|
||||
<xpath expr="//chatter" position="replace"/>
|
||||
|
||||
<!-- El botón rojo solo tiene sentido sobre un registro guardado:
|
||||
no hay nada que anonimizar en uno nuevo. -->
|
||||
<xpath expr="//button[@name='action_beyond_anonymize']" position="attributes">
|
||||
<attribute name="invisible">not id</attribute>
|
||||
<!-- El botón rojo baja al PIE de la ficha, junto a Guardar y
|
||||
Descartar y alineado a la derecha, como el diseño. Estaba en el
|
||||
<header>, que en Odoo es la franja de estados bajo el
|
||||
encabezado: ahí quedaba solo, enorme y como si fuera la acción
|
||||
principal de la pantalla. Y solo sobre un registro guardado: no
|
||||
hay nada que anonimizar en uno nuevo. -->
|
||||
<xpath expr="//button[@name='action_beyond_anonymize']" position="replace"/>
|
||||
<xpath expr="//sheet" position="inside">
|
||||
<div class="beyond_cliente_acciones">
|
||||
<button name="action_beyond_anonymize" type="object"
|
||||
string="Anonimizar (LFPDPPP)"
|
||||
class="btn-secondary beyond_boton_destructivo"
|
||||
invisible="not id"
|
||||
groups="beyond_base.beyond_group_admin_general"
|
||||
confirm="Se eliminarán de forma permanente el nombre, la foto y los datos de contacto de este cliente, y el registro quedará archivado. Esta acción responde a una solicitud del titular y no se puede deshacer. ¿Continuar?"/>
|
||||
</div>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 7.4 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 4.0 KiB |
@@ -10,6 +10,13 @@
|
||||
#
|
||||
# beyond_dev is for looking at screens; this is for knowing whether it works.
|
||||
#
|
||||
# EL NAVEGADOR. The suite runs inside a throwaway container built from
|
||||
# Dockerfile.test, which is the runtime image plus a pinned Chromium. Odoo
|
||||
# drives it through browser_js to run the hoot unit tests and the tours;
|
||||
# WITHOUT a browser it skips them and reports green. The dev compose and the
|
||||
# production image are untouched — this is a third artifact, the same one the
|
||||
# CI will use.
|
||||
#
|
||||
# The database is dropped at the end, including when a test fails. Keep it for
|
||||
# a post mortem with: ./scripts/pruebas.sh --conservar
|
||||
#
|
||||
@@ -22,18 +29,19 @@ set -euo pipefail
|
||||
DB="${BEYOND_TEST_DB:-beyond_test}"
|
||||
MODULOS="beyond_base,beyond_branch,beyond_customer,beyond_product_capture,beyond_attendance_qr,beyond_pos_theme"
|
||||
CONSERVAR=0
|
||||
SUITE_COMPLETA=1
|
||||
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
--conservar) CONSERVAR=1 ;;
|
||||
--*) echo "Opción desconocida: $arg" >&2; exit 2 ;;
|
||||
*) MODULOS="$arg" ;;
|
||||
*) MODULOS="$arg"; SUITE_COMPLETA=0 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Ports of their own: the dev server holds 8069 and the HttpCase tests need to
|
||||
# bind something. Without this the whole run dies with "Address already in use"
|
||||
# before a single test starts.
|
||||
# Ports of their own. The suite now runs in its own container, so the clash
|
||||
# with the dev server is gone, but the values stay explicit: the browser tests
|
||||
# build their URLs from them.
|
||||
PUERTO="${BEYOND_TEST_PORT:-8169}"
|
||||
PUERTO_GEVENT="${BEYOND_TEST_GEVENT_PORT:-8172}"
|
||||
|
||||
@@ -59,6 +67,12 @@ docker compose exec -T db createdb -U odoo -O odoo "$DB"
|
||||
# script exists to remove.
|
||||
ETIQUETAS="$(echo "$MODULOS" | tr ',' '\n' | sed 's|^|/|' | paste -sd, -)"
|
||||
|
||||
IMAGEN="${BEYOND_TEST_IMAGE:-beyond-test:local}"
|
||||
RED="${BEYOND_TEST_NETWORK:-beyond_default}"
|
||||
|
||||
echo "[*] Construyendo la imagen de pruebas ($IMAGEN)..."
|
||||
docker build -q -f Dockerfile.test -t "$IMAGEN" . > /dev/null
|
||||
|
||||
echo "[*] Instalando $MODULOS con datos demo y corriendo su suite..."
|
||||
# -i and not -u: the point is a fresh install.
|
||||
#
|
||||
@@ -68,8 +82,19 @@ echo "[*] Instalando $MODULOS con datos demo y corriendo su suite..."
|
||||
# ticked. Without this flag there are no demo branches and the tests that look
|
||||
# one up fail on an empty search. The demo data is also part of what has to
|
||||
# keep working (CLAUDE.md, "demostrarlo en 2 minutos").
|
||||
docker compose exec -T odoo odoo \
|
||||
-d "$DB" -i "$MODULOS" --with-demo \
|
||||
# --shm-size=1g: Chromium comparte memoria entre procesos por /dev/shm, y el
|
||||
# valor por defecto de Docker (64 MB) lo hace caerse a media suite con
|
||||
# «Target crashed». Es la causa clásica de una suite de navegador intermitente.
|
||||
# --network: para alcanzar el Postgres del compose por su nombre de servicio,
|
||||
# que es el que ya trae odoo.conf.
|
||||
docker run --rm \
|
||||
--network "$RED" \
|
||||
--shm-size=1g \
|
||||
-e PGPASSWORD="$(grep -E '^DB_PASSWORD=' .env | cut -d= -f2-)" \
|
||||
-v "$PWD/addons:/mnt/extra-addons:ro" \
|
||||
-v "$PWD/odoo.conf:/etc/odoo/odoo.conf:ro" \
|
||||
"$IMAGEN" \
|
||||
odoo -d "$DB" -i "$MODULOS" --with-demo \
|
||||
--test-enable --test-tags="$ETIQUETAS" --stop-after-init \
|
||||
--http-port="$PUERTO" --gevent-port="$PUERTO_GEVENT" \
|
||||
2>&1 | tee /tmp/beyond_pruebas.log | grep -E \
|
||||
@@ -101,7 +126,9 @@ INESPERADOS="$(comm -23 <(echo "$REALES") <(echo "$ESPERADOS_ORD") | sed '/^$/d'
|
||||
ARREGLADOS="$(comm -13 <(echo "$REALES") <(echo "$ESPERADOS_ORD") | sed '/^$/d')"
|
||||
|
||||
echo
|
||||
if [ -n "$ARREGLADOS" ]; then
|
||||
# Solo tiene sentido con la suite completa: corriendo un módulo suelto, los
|
||||
# esperados de otro no aparecen y se leerían como «ya pasan».
|
||||
if [ -n "$ARREGLADOS" ] && [ "$SUITE_COMPLETA" -eq 1 ]; then
|
||||
echo "[!] Estos tests estaban en la lista de esperados y ya PASAN."
|
||||
echo " Quítalos de ESPERADOS en este script:"
|
||||
echo "$ARREGLADOS" | sed 's/^/ /'
|
||||
|
||||