diff --git a/CLAUDE.md b/CLAUDE.md
index 39f5a39..9d1f13a 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -24,6 +24,7 @@ Sistema de gestión multisucursal para Beyond (red de sucursales en Puebla, Méx
4. **Español** en toda cadena visible al usuario. Código, nombres de campos, modelos y comentarios técnicos en inglés.
5. **Nada que corra en la carga de módulos puede impedir el arranque** (ADR-011). Toda tarea de ``, `init()` o hook va envuelta en `ejecutar_en_arranque` (`beyond_base/tools/arranque.py`): si falla, se registra y el sistema levanta. Los datos de módulo **no** escriben sobre modelos con guardias de estado (`pos.config`, `account.tax`, `pos.payment.method`): eso va en una función que detecta la condición y difiere. Una caja de POS abierta ya tumbó producción una vez.
6. **Aislamiento por sucursal es sagrado:** cualquier modelo operativo nuevo lleva `branch_id` y su `ir.rule`. Todo cambio de permisos lleva test automatizado (brief, sección 4).
+7. **No modificar el entorno del desarrollador** (credenciales, bases, configuración, servicios) **sin autorización explícita en el encargo** (23-ago-2026). Si falta acceso, preguntar u operar en stack desechable. Todo cambio de entorno autorizado se reporta con su reversa.
## Convenciones
diff --git a/addons/beyond_base/__manifest__.py b/addons/beyond_base/__manifest__.py
index 4e661c6..cadae3e 100644
--- a/addons/beyond_base/__manifest__.py
+++ b/addons/beyond_base/__manifest__.py
@@ -9,24 +9,29 @@ Cimientos del sistema Beyond (BRIEF §4 y §6):
administrador de sucursal y empleado. Las reglas de registro (ir.rule)
que aíslan datos por sucursal llegan en Fase 1 junto con beyond_branch.
- Branding: nombre "Beyond" de la instancia, identidad visual v1 definida
- por Collina (paleta y tipografía Manrope autoalojada) y el lanzador de
- aplicaciones a pantalla completa (ADR-005).
+ por Collina (paleta y tipografía Manrope autoalojada), el lanzador de
+ aplicaciones a pantalla completa (ADR-005) y la pantalla de inicio de
+ sesión, que hereda web.login sin tocar ni el formulario ni la ruta.
Depende de hr/hr_attendance porque el rol "empleado" se define sobre
empleados y asistencias, y las ir.rule de Fase 1 para esos modelos
-vivirán en este módulo.
+vivirán en este módulo. Depende de auth_signup (LGPL, el core lo
+auto-instala igual) para fijar el orden de herencia sobre web.login: el
+enlace de "¿Olvidaste tu contraseña?" es el suyo, con su condición real.
""",
'version': '19.0.0.1.0',
'category': 'Beyond',
'author': 'Collina Systems',
'license': 'Other proprietary',
- 'depends': ['base', 'web', 'hr', 'hr_attendance'],
+ 'depends': ['base', 'web', 'auth_signup', 'hr', 'hr_attendance'],
'data': [
'security/beyond_security.xml',
'data/branding.xml',
'data/bootstrap_admin.xml',
'data/menu_cleanup.xml',
'data/idioma.xml',
+ 'data/signup.xml',
+ 'views/login_templates.xml',
],
'demo': [
'demo/demo_empleados.xml',
@@ -36,10 +41,18 @@ vivirán en este módulo.
('prepend', 'beyond_base/static/src/scss/beyond_variables.scss'),
],
'web.assets_backend': [
+ 'beyond_base/static/src/scss/beyond_fonts.scss',
'beyond_base/static/src/webclient/beyond_launcher.scss',
'beyond_base/static/src/webclient/beyond_launcher.js',
'beyond_base/static/src/webclient/beyond_launcher.xml',
],
+ # The login screen renders before there is a session: it gets the
+ # frontend bundle and nothing else, so the face travels with it.
+ 'web.assets_frontend': [
+ 'beyond_base/static/src/scss/beyond_fonts.scss',
+ 'beyond_base/static/src/login/beyond_login.scss',
+ 'beyond_base/static/src/login/beyond_login.js',
+ ],
},
'installable': True,
'application': False,
diff --git a/addons/beyond_base/data/signup.xml b/addons/beyond_base/data/signup.xml
new file mode 100644
index 0000000..815b0cb
--- /dev/null
+++ b/addons/beyond_base/data/signup.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
diff --git a/addons/beyond_base/models/__init__.py b/addons/beyond_base/models/__init__.py
index 4f55328..d349d00 100644
--- a/addons/beyond_base/models/__init__.py
+++ b/addons/beyond_base/models/__init__.py
@@ -1,2 +1,3 @@
# Part of Beyond. Collina Systems proprietary module.
from . import res_lang
+from . import res_users
diff --git a/addons/beyond_base/models/res_users.py b/addons/beyond_base/models/res_users.py
new file mode 100644
index 0000000..9c37e08
--- /dev/null
+++ b/addons/beyond_base/models/res_users.py
@@ -0,0 +1,51 @@
+# Part of Beyond. Collina Systems proprietary module.
+from odoo import api, models
+
+from odoo.addons.beyond_base.tools.arranque import ejecutar_en_arranque
+
+# auth_signup se instala solo (auto_install) y llega con la puerta abierta: sus
+# datos ponen auth_signup.invitation_scope en 'b2c' — "Free sign up" —, que deja
+# /web/signup accesible a cualquiera que teclee la URL. En un ERP de personal de
+# sucursal eso es un alta de cuenta sin invitación contra el sistema que lleva
+# la caja. A Beyond se entra dado de alta por la administración (ADR-008).
+#
+# Con 'b2b' Odoo cierra las dos puertas por su cuenta: la ruta /web/signup sin
+# token devuelve 404, y _signup_create_user levanta SignupError si alguien
+# postea sin invitación. No se toca ni la ruta ni el controlador; se le da al
+# core el valor con el que ya sabe defenderse.
+#
+# El alta CON invitación sigue funcionando, y tiene que seguir: es la vía por la
+# que el aprovisionador manda el correo de bienvenida al dar de alta a alguien.
+ALTA_SOLO_POR_INVITACION = 'b2b'
+
+PARAMETRO_ALTA = 'auth_signup.invitation_scope'
+
+
+class ResUsers(models.Model):
+ _inherit = 'res.users'
+
+ @api.model
+ def _beyond_arranque_alta_publica(self):
+ """Entrada desde la carga de módulos (data/signup.xml). Va envuelta: una
+ tarea de arranque degrada, nunca tumba el servidor (ADR-011)."""
+ return ejecutar_en_arranque(
+ self.env, 'Alta pública cerrada', self._beyond_cerrar_alta_publica)
+
+ @api.model
+ def _beyond_cerrar_alta_publica(self):
+ """Deja el alta pública cerrada en cualquier despliegue.
+
+ Corre en cada actualización del módulo, que en producción corre en cada
+ arranque: el candado no depende de que alguien se acuerde de tocar el
+ interruptor en Ajustes, y una base restaurada o clonada llega cerrada
+ sola. Idempotente: si ya está cerrada no escribe nada.
+
+ Que se reafirme en cada actualización es lo que se quiere. Si el día de
+ mañana Beyond decide abrir el alta pública, la decisión se toma aquí y
+ queda en el repositorio, no en un clic que la siguiente actualización
+ deshace sin que nadie se entere.
+ """
+ parametros = self.env['ir.config_parameter'].sudo()
+ if parametros.get_param(PARAMETRO_ALTA) != ALTA_SOLO_POR_INVITACION:
+ parametros.set_param(PARAMETRO_ALTA, ALTA_SOLO_POR_INVITACION)
+ return True
diff --git a/addons/beyond_base/static/img/logo_login.png b/addons/beyond_base/static/img/logo_login.png
new file mode 100644
index 0000000..d47fe77
Binary files /dev/null and b/addons/beyond_base/static/img/logo_login.png differ
diff --git a/addons/beyond_base/static/src/login/beyond_login.js b/addons/beyond_base/static/src/login/beyond_login.js
new file mode 100644
index 0000000..d3754d1
--- /dev/null
+++ b/addons/beyond_base/static/src/login/beyond_login.js
@@ -0,0 +1,44 @@
+/**
+ * Beyond — login v1: the eye that shows the password.
+ *
+ * Core ships this behaviour (web/static/src/public/show_password.js) but it is
+ * bound to a Bootstrap `.input-group` wrapping a `.o_show_password` button with
+ * a Font Awesome icon, and it says nothing to a screen reader. The login screen
+ * uses the design's own pill and its own SVG, so the toggle is rewritten here —
+ * eight lines and the ARIA that core leaves out.
+ *
+ * Deliberately a plain script and not an Interaction: this runs on the page
+ * that precedes the session, where the less machinery involved in reaching the
+ * password field, the better. It touches nothing but the input's `type`.
+ *
+ * Not touched: the form, its action, its method or the csrf_token.
+ */
+(function () {
+ "use strict";
+
+ // Spanish, like every string a user reads (CLAUDE.md).
+ const LABEL_SHOW = "Mostrar contraseña";
+ const LABEL_HIDE = "Ocultar contraseña";
+
+ function setUpPasswordToggle() {
+ const eye = document.querySelector(".beyond_login .beyond_login_eye");
+ const password = document.querySelector(".beyond_login #password");
+ if (!eye || !password) {
+ return;
+ }
+ eye.addEventListener("click", function () {
+ const wasVisible = password.type === "text";
+ password.type = wasVisible ? "password" : "text";
+ eye.setAttribute("aria-pressed", String(!wasVisible));
+ eye.setAttribute("aria-label", wasVisible ? LABEL_SHOW : LABEL_HIDE);
+ // Back to typing where the user left off, not on the button.
+ password.focus();
+ });
+ }
+
+ if (document.readyState === "loading") {
+ document.addEventListener("DOMContentLoaded", setUpPasswordToggle);
+ } else {
+ setUpPasswordToggle();
+ }
+})();
diff --git a/addons/beyond_base/static/src/login/beyond_login.scss b/addons/beyond_base/static/src/login/beyond_login.scss
new file mode 100644
index 0000000..d785afd
--- /dev/null
+++ b/addons/beyond_base/static/src/login/beyond_login.scss
@@ -0,0 +1,500 @@
+// =============================================================================
+// Beyond — login v1
+//
+// Faithful translation of the signed-off "Iniciar sesión" (login_v1.html).
+// Every colour, radius, size, gap, duration and font weight below is copied
+// from that file, unrounded; the rules that have no counterpart there are
+// marked ENGINEERING and say what they protect against — the design only
+// covers the nominal case, and this one sits on top of Odoo's real login form.
+//
+// SCOPE — everything is nested under .beyond_login / .beyond_login_body. This
+// file rides web.assets_frontend, which every public page loads (the employee
+// portal of beyond_attendance_qr among them), so not one rule may escape the
+// login screen. The QR kiosk is a standalone template that calls no
+// bundle at all and is out of reach by construction.
+//
+// PALETTE — the surfaces and the ink are the identity's own tokens; the design
+// reuses them exactly. The black is NOT: the design paints the controls
+// #191613 instead of the brand green, deliberately, so the pre-session screen
+// reads as the product's cover rather than as another green ERP form. Per the
+// rule written in scss/beyond_variables.scss ("a colour graduates to a token
+// when a SECOND screen needs it") that black, the field white, the placeholder
+// grey and the eye's hover stay local variables here. So does the error
+// orange, even though it is byte-for-byte the launcher's "Panel General":
+// same hex, unrelated meaning.
+// =============================================================================
+
+// The control black of the login and its hover/pressed states.
+$beyond-login-ink: #191613;
+$beyond-login-ink-hover: #33302B;
+$beyond-login-ink-active: #000000;
+
+// The brand panel behind the logo — flat black, not the ink above.
+$beyond-login-brand-bg: #000000;
+
+// Fields
+$beyond-login-field-bg: #FFFFFF;
+$beyond-login-placeholder: #B3ADA3;
+$beyond-login-eye-hover: #F0EEE8;
+
+// The focus ring the design draws around a field in focus.
+$beyond-login-ring: rgba(25, 22, 19, 0.10);
+
+// Error text. Same hex as $beyond-launcher-panel and unrelated to it.
+$beyond-login-error: #C55A22;
+
+// -----------------------------------------------------------------------------
+// Page
+//
+// ENGINEERING — the class replaces Odoo's `bg-100` on rather than
+// joining it (see views/login_templates.xml): the utility paints the body with
+// !important and there is no point in an override war on a page we own whole.
+// -----------------------------------------------------------------------------
+.beyond_login_body {
+ margin: 0;
+ padding: 0;
+ background: $beyond-surface;
+ color: $beyond-ink;
+ font-family: $beyond-font-family;
+ -webkit-font-smoothing: antialiased;
+ overflow: hidden; // the design is 100vh with no scroll
+}
+
+.beyond_login {
+ height: 100vh;
+ display: flex;
+ background: $beyond-surface;
+ color: $beyond-ink;
+ overflow: hidden;
+
+ // ---------------------------------------------------------------------
+ // Left: the brand panel
+ // ---------------------------------------------------------------------
+ .beyond_login_brand {
+ flex: 1 1 46%;
+ min-width: 0;
+ background: $beyond-login-brand-bg;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ padding: 56px;
+ }
+
+ .beyond_login_logo {
+ display: block;
+ // The design says `width: min(360px, 72%)`. Written as a pair because
+ // Sass evaluates a bare min() itself and refuses to compare px with %;
+ // the used width is identical.
+ width: 72%;
+ max-width: 360px;
+ height: auto;
+ }
+
+ // ---------------------------------------------------------------------
+ // Right: the form
+ // ---------------------------------------------------------------------
+ .beyond_login_panel {
+ flex: 1 1 54%;
+ min-width: 0;
+ display: flex;
+ justify-content: center;
+ padding: 40px;
+ overflow-y: auto;
+ }
+
+ .beyond_login_stack {
+ box-sizing: border-box;
+ width: 100%;
+ max-width: 440px;
+ margin: auto;
+ display: flex;
+ flex-direction: column;
+ gap: 26px;
+ }
+
+ // ENGINEERING — web.login ships two empty `oe_structure` drop zones around
+ // the form. Empty flex children still eat a 26px gap each, so they are
+ // hidden while empty and left alone the moment anything is dropped in.
+ .oe_structure:empty {
+ display: none;
+ }
+
+ .beyond_login_title {
+ font-size: 34px;
+ font-weight: 800;
+ letter-spacing: -0.03em;
+ color: $beyond-ink;
+ }
+
+ // The form is a column on the same 26px rhythm as the stack around it, so
+ // title / user / password / CTA / error / signature read as one list.
+ .beyond_login_form {
+ display: flex;
+ flex-direction: column;
+ gap: 26px;
+ }
+
+ // ENGINEERING — the database picker is core's, shown only when the server
+ // serves more than one database. It keeps its Bootstrap look (a developer
+ // sees it, an employee never does); all it needs is to stop fighting the
+ // column's own rhythm with a utility margin.
+ .beyond_login_form > .mb-3 {
+ margin-bottom: 0 !important;
+ }
+
+ // ---------------------------------------------------------------------
+ // Fields
+ // ---------------------------------------------------------------------
+ .beyond_login_field {
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+ }
+
+ .beyond_login_field_head {
+ display: flex;
+ align-items: baseline;
+ justify-content: space-between;
+ gap: 12px;
+ }
+
+ .beyond_login_label {
+ margin: 0; // ENGINEERING — Bootstrap's reboot puts a margin on
',
+ respuesta.text, re.S)
+ self.assertTrue(error and error.group(1).strip(),
+ "el hueco del error está vacío")
+
+ def test_credenciales_buenas_redirigen(self):
+ """No hay pantalla de «Bienvenido»: Odoo redirige y el usuario cae en
+ el Menú Principal."""
+ respuesta = self._entrar(self.LOGIN, self.CLAVE)
+ self.assertIn(respuesta.status_code, (302, 303),
+ "una autenticación correcta sale del login redirigiendo")
+ self.assertNotIn('Bienvenido,', respuesta.text)
diff --git a/addons/beyond_base/tests/test_signup.py b/addons/beyond_base/tests/test_signup.py
new file mode 100644
index 0000000..69e4dea
--- /dev/null
+++ b/addons/beyond_base/tests/test_signup.py
@@ -0,0 +1,74 @@
+# Part of Beyond. Collina Systems proprietary module.
+from odoo.tests import HttpCase, tagged
+
+from odoo.addons.beyond_base.models.res_users import (
+ ALTA_SOLO_POR_INVITACION, PARAMETRO_ALTA)
+
+
+@tagged('post_install', '-at_install')
+class TestBeyondAltaPublica(HttpCase):
+ """El alta pública está cerrada, y lo está por datos del módulo.
+
+ Quitar el enlace de la pantalla de inicio de sesión no cierra nada: la
+ ruta /web/signup seguía respondiendo a cualquiera que teclease la URL,
+ porque auth_signup se instala con invitation_scope en 'b2c'. El candado
+ vive en data/signup.xml y se reafirma en cada actualización, para que no
+ dependa de un clic en Ajustes ni se pierda al clonar la base.
+ """
+
+ def _parametro(self):
+ return self.env['ir.config_parameter'].sudo().get_param(PARAMETRO_ALTA)
+
+ def test_el_candado_quedo_puesto(self):
+ self.assertEqual(self._parametro(), ALTA_SOLO_POR_INVITACION)
+
+ def test_el_candado_se_repone_solo(self):
+ """Alguien lo abre desde Ajustes; la siguiente actualización lo cierra."""
+ self.env['ir.config_parameter'].sudo().set_param(PARAMETRO_ALTA, 'b2c')
+ self.env['res.users']._beyond_cerrar_alta_publica()
+ self.assertEqual(self._parametro(), ALTA_SOLO_POR_INVITACION)
+
+ def test_es_idempotente(self):
+ """Cerrado y vuelto a cerrar, no escribe ni cambia nada."""
+ self.env['res.users']._beyond_cerrar_alta_publica()
+ self.env['res.users']._beyond_cerrar_alta_publica()
+ self.assertEqual(self._parametro(), ALTA_SOLO_POR_INVITACION)
+
+ # -- La ruta ---------------------------------------------------------------
+
+ def test_signup_sin_invitacion_no_existe(self):
+ """Con el candado puesto, Odoo ni siquiera sirve el formulario."""
+ respuesta = self.url_open('/web/signup', allow_redirects=False)
+ self.assertEqual(respuesta.status_code, 404,
+ "/web/signup sigue abierta a cualquiera con la URL")
+
+ def test_no_se_puede_registrar_sin_invitacion(self):
+ """Y un POST directo, saltándose el formulario, tampoco crea cuenta."""
+ correo = 'intruso@beyond.example'
+ pagina = self.url_open('/web/login')
+ csrf = pagina.text.split('name="csrf_token" value="')[1].split('"')[0]
+ respuesta = self.url_open('/web/signup', allow_redirects=False, data={
+ 'login': correo,
+ 'name': 'Intruso',
+ 'password': 'una-contrasena-cualquiera',
+ 'confirm_password': 'una-contrasena-cualquiera',
+ 'csrf_token': csrf,
+ })
+ self.assertEqual(respuesta.status_code, 404)
+ self.assertFalse(
+ self.env['res.users'].sudo().with_context(active_test=False).search(
+ [('login', '=', correo)]),
+ "se creó una cuenta sin invitación")
+
+ def test_el_alta_con_invitacion_sigue_viva(self):
+ """El candado cierra la puerta de la calle, no la del aprovisionador:
+ el alta por invitación (ADR-008) tiene que seguir funcionando."""
+ usuario = self.env['res.users'].create({
+ 'name': 'Invitada Beyond',
+ 'login': 'invitada@beyond.example',
+ })
+ usuario.partner_id.signup_prepare()
+ token = usuario.partner_id.sudo()._generate_signup_token()
+ respuesta = self.url_open('/web/signup?token=%s' % token)
+ self.assertEqual(respuesta.status_code, 200,
+ "una invitación válida dejó de servir el formulario")
diff --git a/addons/beyond_base/views/login_templates.xml b/addons/beyond_base/views/login_templates.xml
new file mode 100644
index 0000000..f0bc62b
--- /dev/null
+++ b/addons/beyond_base/views/login_templates.xml
@@ -0,0 +1,188 @@
+
+
+
+
+
+
+
+ 'beyond_login_body' if beyond_login else 'bg-100'
+
+
+ not beyond_login
+
+
+