Files
Collina-Matrix/addons/matrix_base/views/login_templates.xml
T
Fernando Dávila 86cd6a6cdd Lleva la marca de MATRIX_MARCA a Python, plantillas, cliente web y caja
El nombre de la casa estaba escrito en cada capa. Ahora todas lo leen del
mismo origen, `instancia.marca()`, que sale de la variable MATRIX_MARCA y
por omisión conserva el nombre de siempre:

- Python: la compañía matriz (desaparece NOMBRE_COMPANIA) y la app
  instalable, que deja de leerlo de la compañía; títulos, nombres de
  archivo, metadatos y pie de los Excel y PDF del motor de descargas y del
  comprobante de venta.
- Plantillas del servidor: `ir.qweb._prepare_environment` pone
  `matrix_marca` en los valores de toda plantilla. Lo usan el inicio de
  sesión, el título de respaldo de la pestaña, la página sin conexión, el
  kiosco, la checada, el portal del colaborador y la pestaña de la caja.
- Cliente web: `session_info()` y `get_frontend_session_info()` llevan
  `matrix_marca`; la pestaña y el título por omisión de los diálogos lo
  leen de `session`. En JavaScript no hay valor por omisión con la marca.
- Caja: se sirve con el mismo `session_info`; el `alt` del candado y el del
  protector salen de un getter añadido por patch.

La marca no se restringe para acomodar a quien la usa: cada sumidero la
sanea para su formato. El nombre de archivo se queda con letras, dígitos,
`_` y `-`; el título se escapa donde reportlab lo lee como marcado y no
antes, porque ese mismo texto va al Excel y a los metadatos; las cabeceras
de descarga ya iban por `http.content_disposition`.

Las pruebas usan una marca con acentos, ñ, «&» y apóstrofo, y entran por
HTTP, por el navegador y por las unitarias de hoot. Las que afirmaban el
literal leen ahora `instancia.marca()` o fijan la marca de prueba.

El título de respaldo de la pestaña pasa de t-esc a t-out, que es la
directiva vigente: un aviso de obsoleta menos en el registro.
2026-11-21 16:56:19 -06:00

208 lines
11 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!--
Matrix — login v1.
The signed-off "Iniciar sesión" screen, built by inheriting web.login
and web.login_layout. No core file is touched and no controller is
overridden: the form that posts to /web/login is Odoo's own, kept whole
with its action, its method, its csrf_token and its redirect. What
changes is the markup around the fields and the shell it renders in.
Both templates carry priority="99" so they are the LAST arch applied to
web.login. auth_signup and auth_passkey also inherit it, and the order
has to be a decision rather than a coincidence of module ids: this file
replaces the block that auth_signup drops its "Restablecer contraseña"
link into, and it can only do that reliably if the link is already
there when it runs. matrix_base depends on auth_signup for the same
reason (see __manifest__.py).
THREE THINGS THE DESIGN ASKS FOR THAT ARE NOT HERE, on purpose:
1. Live validation. The mock decides on its own that the fields are
empty and writes its own message. Here every message is the
server's, after the POST — a wrong password is Odoo's string,
rendered in the design's voice by scss/../login/matrix_login.scss.
The only client-side check left is core's own `required`.
2. The "Bienvenido, X" screen. There is nothing to build: a correct
login is a 303 out of /web/login and the browser lands on the Menú
Principal (the launcher, ADR-005). The mock needed that screen
because it had nowhere to go.
3. The eye's own logic. It lives in login/matrix_login.js, because the
type of an input is not something a template can toggle.
AND THREE THINGS THE DESIGN DID NOT KNOW ABOUT, decided here:
- web.user_switch (Odoo 19) is removed. It is the "Choose a user"
screen that hides the form behind the last accounts to log in on this
browser. On a shop terminal shared by a shift that is a list of
colleagues' names and faces on the pre-session screen, and the design
has no such state.
- The signup link ("¿No tienes una cuenta?") is removed. Matrix staff
are provisioned by the branch administrator (ADR-008); nobody signs
themselves up. NOTE this only takes the link off this screen — the
/web/signup route stays open until `auth_signup.invitation_scope` is
set to b2b in Ajustes.
- The passkey block (auth_passkey) is REMOVED (14-sep-2026), reversing
the earlier decision to keep it restyled, and so is every other
passkey door in the system (views/passkey_templates.xml, which lists
them). Only the doors are hidden: keys already registered are NOT
deleted and auth_passkey stays installed, so bringing them back is
putting the xpaths back. Here it is taken out at its
`t-call="web.login_oauth"`, which renders the "- o -" separator and
every button in `auth_btns` — today only the passkey, since
auth_oauth is not installed.
-->
<!--
The shell. web.login_layout wraps its content in a centred 300px card
with the company logo on top and an "Con la tecnología de Odoo" footer
under it. The login screen is a full-bleed two-column page, so on this
page the card is not overridden, it is not rendered at all.
`matrix_login` is set by the template below, inside the body of the
t-call — QWeb renders that body first and the t-set reaches here. The
other pages that share this layout (restablecer contraseña, alta,
sesión iniciada) never set it and are left exactly as they were.
-->
<template id="login_layout_matrix" inherit_id="web.login_layout" priority="99"
name="Collina Matrix — envoltura de inicio de sesión">
<xpath expr="//t[@t-set='body_classname']" position="attributes">
<attribute name="t-value">'matrix_login_body' if matrix_login else 'bg-100'</attribute>
</xpath>
<xpath expr="//div[hasclass('container')]" position="attributes">
<attribute name="t-if">not matrix_login</attribute>
</xpath>
<xpath expr="//div[hasclass('container')]" position="after">
<div t-if="matrix_login" class="matrix_login">
<div class="matrix_login_brand">
<!--
Absolute path on purpose: this page precedes the
session and resolves nothing through the backend.
20 KB PNG, white type on transparency, from the 1.2 MB
JPEG the design shipped.
-->
<!-- El alt es el nombre de la casa: lo pone ir.qweb en
toda plantilla (models/ir_qweb.py) y t-att lo escapa. -->
<img class="matrix_login_logo" t-att-alt="matrix_marca"
src="/matrix_base/static/img/logo_login.png"/>
</div>
<div class="matrix_login_panel">
<div class="matrix_login_stack">
<t t-out="0"/>
</div>
</div>
</div>
</xpath>
</template>
<!-- The form itself. -->
<template id="login_matrix" inherit_id="web.login" priority="99"
name="Collina Matrix — iniciar sesión">
<!-- Read by the layout above. `disable_footer` takes out the "Gestionar
bases de datos" and Odoo branding line under the card. -->
<xpath expr="//form[@role='form']" position="before">
<t t-set="matrix_login" t-value="True"/>
<t t-set="disable_footer" t-value="True"/>
<span class="matrix_login_title">Iniciar sesión</span>
</xpath>
<!-- La firma va en inglés en las dos pantallas que la llevan, esta y el
Menú Principal (webclient/matrix_launcher.xml). Es una excepción
deliberada a la regla 4 de CLAUDE.md — «español en toda cadena
visible» —, decidida el 23-ago-2026: es la marca de Collina, no
una cadena de la interfaz, y valía más que fuera la misma en
ambas que traducida en una y no en la otra. Si cambia, cambian
las dos. -->
<xpath expr="//form[@role='form']" position="after">
<span class="matrix_login_sign">Powered by Collina Systems</span>
</xpath>
<!-- See the web.user_switch note at the top of this file. -->
<xpath expr="//owl-component[@name='web.user_switch']" position="replace"/>
<!-- Core hides the form with `d-none` and lets the user switcher decide
whether to show it. With the switcher gone the form is the screen,
so the class stops being computed. -->
<xpath expr="//form[@role='form']" position="attributes">
<attribute name="t-attf-class"/>
<attribute name="class">oe_login_form matrix_login_form</attribute>
</xpath>
<xpath expr="//div[hasclass('field-login')]" position="replace">
<div class="matrix_login_field">
<div class="matrix_login_field_head">
<label for="login" class="matrix_login_label">Nombre de usuario</label>
</div>
<!-- name="login" is what /web/login reads. The design calls it
"Nombre de usuario" because that is what the staff type;
Odoo accepts the login, mail or not. -->
<input type="text" name="login" id="login" class="matrix_login_input"
t-att-value="login" placeholder="Usuario"
required="required" autocapitalize="off" autocomplete="username"
t-att-autofocus="'autofocus' if not login else None"/>
</div>
</xpath>
<!-- The o_caps_lock_warning class rides along: core's interaction hangs
its "¡Bloq Mayús está activado!" off it, which is worth keeping on
a screen where you type blind. -->
<xpath expr="//div[hasclass('o_caps_lock_warning')]" position="replace">
<div class="matrix_login_field o_caps_lock_warning">
<div class="matrix_login_field_head">
<label for="password" class="matrix_login_label">Contraseña</label>
<!-- The real reset route, behind the real switch: Ajustes →
"Restablecer contraseña" (auth_signup.reset_password).
Off, and the link is not rendered — the same condition
core uses, only the copy is the design's. -->
<a t-if="reset_password_enabled" class="matrix_login_forgot"
t-attf-href="/web/reset_password?{{ keep_query() }}">¿Olvidaste tu contraseña?</a>
</div>
<div class="matrix_login_pw">
<input type="password" name="password" id="password"
class="matrix_login_input_pw" placeholder="••••••••••"
required="required" autocomplete="current-password"
maxlength="4096"
t-att-autofocus="'autofocus' if login else None"/>
<button type="button" class="matrix_login_eye"
aria-label="Mostrar contraseña" aria-pressed="false">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true">
<path d="M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12Z"
stroke="currentColor" stroke-width="2"/>
<circle cx="12" cy="12" r="3.2" stroke="currentColor" stroke-width="2"/>
</svg>
</button>
</div>
</div>
</xpath>
<!-- The server's own messages, stripped of Bootstrap's alert box so the
design's 14px/700 can show. The text and the t-if stay core's. -->
<xpath expr="//p[hasclass('alert-danger')]" position="attributes">
<attribute name="class">matrix_login_error</attribute>
</xpath>
<xpath expr="//p[hasclass('alert-success')]" position="attributes">
<attribute name="class">matrix_login_message</attribute>
</xpath>
<!-- oe_login_buttons is kept in the class list: auth_signup hangs its
arch off it. -->
<xpath expr="//div[hasclass('oe_login_buttons')]" position="attributes">
<attribute name="class">oe_login_buttons matrix_login_actions</attribute>
</xpath>
<xpath expr="//div[hasclass('oe_login_buttons')]/button[@type='submit']" position="attributes">
<attribute name="class">matrix_login_submit</attribute>
</xpath>
<!-- See the passkey note at the top of this file. The block is not in
web.login's arch: this call renders it, so the call is what goes. -->
<xpath expr="//t[@t-call='web.login_oauth']" position="replace"/>
<!-- See the signup note at the top of this file. -->
<xpath expr="//a[contains(@t-attf-href, '/web/signup')]" position="replace"/>
</template>
</odoo>