From 07a13b7ca28cc726775c079e3ce5ce606d21cc63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorem=20Ju=C3=A1rez?= Date: Tue, 18 Aug 2026 12:47:47 -0600 Subject: [PATCH 1/2] Promueve el morado del lanzador a token de marca MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit El morado dejó de ser la codificación de un bloque: ahora también pinta la pantalla del kiosco y el diálogo "Abrir código QR", así que es el color del checador y sube a beyond_variables.scss como $beyond-kiosco (+ dark/darker). Entran también $beyond-ink-softer para texto de cuerpo y celdas, y $beyond-surface-active para el hover de un control ya tintado. El naranja NO sube: sigue siendo un bloque en una sola pantalla. La regla queda escrita en la cabecera — un color se vuelve token cuando lo necesita una segunda pantalla, no antes. El lanzador consume los tokens nuevos en vez de sus variables locales. Co-Authored-By: Claude Opus 5 (1M context) --- .../static/src/scss/beyond_variables.scss | 25 ++++++++++++++----- .../static/src/webclient/beyond_launcher.scss | 18 ++++++------- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/addons/beyond_base/static/src/scss/beyond_variables.scss b/addons/beyond_base/static/src/scss/beyond_variables.scss index 4c12e8c..36055f6 100644 --- a/addons/beyond_base/static/src/scss/beyond_variables.scss +++ b/addons/beyond_base/static/src/scss/beyond_variables.scss @@ -11,12 +11,17 @@ // the backend and the POS: Odoo's own variables are declared with !default and // therefore respect whatever is defined here. // -// SCOPE — only cross-cutting brand tokens live here. The launcher's orange -// (#C55A22) and purple (#8C4A72) are deliberately NOT tokens: they are not -// brand colours, they are the colour-coding of the three launcher blocks and -// mean nothing outside that screen. Publishing them in this bundle would push -// them into the backend and POS and invite their use as semantic colours. -// They live as local variables in webclient/beyond_launcher.scss. +// SCOPE — only cross-cutting brand tokens live here. A colour graduates to a +// token when a second screen needs it, not before. +// · The purple graduated (18-aug-2026): it started as the launcher's "QR" +// block and now also paints the kiosk page and the "Abrir código QR" +// dialog, so it is the checador's colour and lives here as +// $beyond-kiosco. +// · The launcher's orange (#C55A22) did NOT: it is still the colour-coding +// of one block on one screen and means nothing outside it. It stays a +// local variable in webclient/beyond_launcher.scss. Publishing it in this +// bundle would push it into the backend and POS and invite its use as a +// semantic colour. // // TYPOGRAPHY — the design uses Manrope. The @font-face rules are declared in // webclient/beyond_launcher.scss because the woff2 files are only wired into @@ -29,13 +34,21 @@ $beyond-primary: #0E6B57; $beyond-primary-dark: #0A5B49; $beyond-primary-darker: #084C3D; +// Checador purple. The launcher's "QR" block, the kiosk page background and +// the "Abrir código QR" dialog, with its hover/pressed states. +$beyond-kiosco: #8C4A72; +$beyond-kiosco-dark: #7C3E64; +$beyond-kiosco-darker: #6B3556; + // Surfaces $beyond-surface: #F6F5F1; // warm page background $beyond-surface-hover: #ECEAE3; // hover on a surface-coloured control +$beyond-surface-active: #E2DFD6; // pressed/hover on an already-tinted control // Ink $beyond-ink: #23201D; // primary text, icon strokes, focus ring $beyond-ink-soft: #4A453E; // secondary labels +$beyond-ink-softer: #7A736A; // body copy, table cells, muted icon strokes $beyond-ink-muted: #A39C91; // supporting text (signature, metadata) // Web client brand colour: $o-brand-primary, $o-action and Bootstrap's diff --git a/addons/beyond_base/static/src/webclient/beyond_launcher.scss b/addons/beyond_base/static/src/webclient/beyond_launcher.scss index 9023ba9..cee9b79 100644 --- a/addons/beyond_base/static/src/webclient/beyond_launcher.scss +++ b/addons/beyond_base/static/src/webclient/beyond_launcher.scss @@ -12,9 +12,10 @@ // popover service writes. :has() is supported by the target browsers // (BRIEF §8). // -// Local, on purpose: the orange and purple below are the launcher's block -// colour-coding, not brand colours, so they are NOT tokens in -// scss/beyond_variables.scss. See the SCOPE note there. +// Local, on purpose: the orange below is this one block's colour-coding, not a +// brand colour, so it is NOT a token in scss/beyond_variables.scss. The purple +// used to live here too and graduated to $beyond-kiosco once the kiosk page and +// the "Abrir código QR" dialog started using it. See the SCOPE note there. // ============================================================================= // "Panel General" block @@ -22,11 +23,6 @@ $beyond-launcher-panel: #C55A22; $beyond-launcher-panel-hover: #B14E1B; $beyond-launcher-panel-active: #984115; -// "QR" block -$beyond-launcher-qr: #8C4A72; -$beyond-launcher-qr-hover: #7C3E64; -$beyond-launcher-qr-active: #6B3556; - $beyond-font-family: Manrope, ui-sans-serif, system-ui, sans-serif; // ----------------------------------------------------------------------------- @@ -229,10 +225,10 @@ $beyond-font-family: Manrope, ui-sans-serif, system-ui, sans-serif; } .beyond_block_qr { - background: $beyond-launcher-qr; + background: $beyond-kiosco; - &:hover { background: $beyond-launcher-qr-hover; } - &:active { background: $beyond-launcher-qr-active; } + &:hover { background: $beyond-kiosco-dark; } + &:active { background: $beyond-kiosco-darker; } } // ------------------------------------------------------------------------- From 16398c7cf153e6dd73ab41ebda379588d0274149 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorem=20Ju=C3=A1rez?= Date: Tue, 18 Aug 2026 12:48:01 -0600 Subject: [PATCH 2/2] =?UTF-8?q?Redise=C3=B1a=20la=20pantalla=20del=20kiosc?= =?UTF-8?q?o=20y=20el=20selector=20de=20sucursal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pantalla del kiosco al diseño v2: fondo morado a pantalla completa, QR en tarjeta blanca de radio 32 y, cerrada la ventana, la luna sobre tarjeta translúcida. El JS no cambia: sigue pintando lo que decide /estado y alternando con hidden. La página es pública y no recibe el bundle del backend, así que restata los tokens como custom properties y sirve la Manrope autoalojada de beyond_base. Se retira el enlace "Checa con tu PIN" y el pin_url que lo alimentaba. El resto del PIN queda intacto: se retira completo en un encargo aparte. El selector multi-sucursal pasa de vista de formulario a diálogo OWL: el diseño pide chips, buscador en vivo y su propio encabezado, y una vista de formulario dentro de un modal no los expresa sin pelear con Odoo en cada paso. La acción de servidor devuelve una acción de cliente registrada como función simple, para que el diálogo controle su propio marco. La lógica de C-023 no cambia: con una sucursal se abre directo en pestaña nueva. El modelo sigue siendo la autoridad — el diálogo pregunta qué sucursales puede ver y manda un id que el servidor vuelve a verificar contra las del usuario, con test propio. Co-Authored-By: Claude Opus 5 (1M context) --- addons/beyond_attendance_qr/__manifest__.py | 7 + .../controllers/kiosco.py | 5 +- .../models/beyond_kiosco_abrir.py | 46 ++- .../src/kiosco_abrir/kiosco_abrir_dialog.js | 130 ++++++++ .../src/kiosco_abrir/kiosco_abrir_dialog.scss | 301 ++++++++++++++++++ .../src/kiosco_abrir/kiosco_abrir_dialog.xml | 87 +++++ .../tests/test_kiosco_abrir.py | 33 +- .../views/kiosco_abrir_views.xml | 25 +- .../views/kiosco_templates.xml | 129 ++++++-- 9 files changed, 687 insertions(+), 76 deletions(-) create mode 100644 addons/beyond_attendance_qr/static/src/kiosco_abrir/kiosco_abrir_dialog.js create mode 100644 addons/beyond_attendance_qr/static/src/kiosco_abrir/kiosco_abrir_dialog.scss create mode 100644 addons/beyond_attendance_qr/static/src/kiosco_abrir/kiosco_abrir_dialog.xml diff --git a/addons/beyond_attendance_qr/__manifest__.py b/addons/beyond_attendance_qr/__manifest__.py index 6f1b141..33645d8 100644 --- a/addons/beyond_attendance_qr/__manifest__.py +++ b/addons/beyond_attendance_qr/__manifest__.py @@ -37,6 +37,13 @@ calcada del sistema Taboada de Collina: 'views/portal_templates.xml', 'views/registro_templates.xml', ], + 'assets': { + 'web.assets_backend': [ + 'beyond_attendance_qr/static/src/kiosco_abrir/kiosco_abrir_dialog.scss', + 'beyond_attendance_qr/static/src/kiosco_abrir/kiosco_abrir_dialog.js', + 'beyond_attendance_qr/static/src/kiosco_abrir/kiosco_abrir_dialog.xml', + ], + }, 'demo': [], 'installable': True, 'application': False, diff --git a/addons/beyond_attendance_qr/controllers/kiosco.py b/addons/beyond_attendance_qr/controllers/kiosco.py index c32dba9..34bcf7c 100644 --- a/addons/beyond_attendance_qr/controllers/kiosco.py +++ b/addons/beyond_attendance_qr/controllers/kiosco.py @@ -23,12 +23,11 @@ class BeyondKioscoQR(BeyondKioskController): Token = request.env['beyond.checada.token'].sudo() estado = Token._emitir_para_kiosco(branch)._estado_kiosco() \ if Token._ventana_abierta() else Token.browse()._estado_kiosco() - # PIN de respaldo: el kiosco nativo de asistencias en la misma tablet - pin_url = branch.company_id.sudo().attendance_kiosk_url or '' + # PIN link removed by design decision (18-aug-2026); full PIN removal + # pending backend task — nothing else about the PIN is touched here. return request.render('beyond_attendance_qr.kiosco_page', { 'branch': branch, 'estado': estado, - 'pin_url': pin_url, }) @http.route('/beyond/kiosco//estado', type='http', diff --git a/addons/beyond_attendance_qr/models/beyond_kiosco_abrir.py b/addons/beyond_attendance_qr/models/beyond_kiosco_abrir.py index e089df7..c12e5ed 100644 --- a/addons/beyond_attendance_qr/models/beyond_kiosco_abrir.py +++ b/addons/beyond_attendance_qr/models/beyond_kiosco_abrir.py @@ -1,5 +1,5 @@ # Part of Beyond. Collina Systems proprietary module. -from odoo import _, api, fields, models +from odoo import _, api, models from odoo.exceptions import UserError @@ -12,14 +12,15 @@ class BeyondKioscoAbrir(models.TransientModel): Decisión documentada: el ADMIN GENERAL también lo ve, con selector de todas las sucursales — abre tiendas y hace demos, y el selector ya existe para el caso múltiple. + + Since the v2 redesign (18-aug-2026) the selector is an OWL dialog and + this model is its engine, not a form: it answers which branches the user + may see and turns a pick into the act_url. Branch isolation is decided + here by ir.rule on beyond.branch, never by the client. """ _name = 'beyond.kiosco.abrir' _description = 'Abrir kiosco de sucursal' - branch_id = fields.Many2one( - 'beyond.branch', string='Sucursal', required=True, - default=lambda self: self._branches_del_usuario()[:1]) - def _branches_del_usuario(self): if self.env.user.has_group('beyond_base.beyond_group_admin_general'): return self.env['beyond.branch'].search([]) @@ -35,17 +36,32 @@ class BeyondKioscoAbrir(models.TransientModel): 'general que te asigne la tuya.')) if len(branches) == 1: return self._act_url(branches) - return { - 'type': 'ir.actions.act_window', - 'name': _('Abrir kiosco'), - 'res_model': self._name, - 'view_mode': 'form', - 'target': 'new', - } + # Plain-function client action: the dialog owns its own chrome, which + # a form view in a modal cannot express (chips, live search, grid). + return {'type': 'ir.actions.client', 'tag': 'beyond_kiosco_abrir'} - def action_abrir(self): - self.ensure_one() - return self._act_url(self.branch_id) + @api.model + def sucursales_permitidas(self): + """Rows for the dialog's chips and search table. Read as the user, so + the branch ir.rule is what filters; no domain is trusted from JS.""" + branches = self._branches_del_usuario() + return [{ + 'id': branch.id, + 'code': branch.code or '', + 'name': branch.name or '', + 'street': branch.street or '', + 'city': branch.city or '', + } for branch in branches] + + @api.model + def abrir_sucursal(self, branch_id): + """Confirm from the dialog. The id is re-checked against the user's + own set: the client picks, the server decides.""" + branch = self._branches_del_usuario().filtered( + lambda b: b.id == branch_id) + if not branch: + raise UserError(_('Esa sucursal no está entre las tuyas.')) + return self._act_url(branch) @staticmethod def _act_url(branch): diff --git a/addons/beyond_attendance_qr/static/src/kiosco_abrir/kiosco_abrir_dialog.js b/addons/beyond_attendance_qr/static/src/kiosco_abrir/kiosco_abrir_dialog.js new file mode 100644 index 0000000..ce5094c --- /dev/null +++ b/addons/beyond_attendance_qr/static/src/kiosco_abrir/kiosco_abrir_dialog.js @@ -0,0 +1,130 @@ +/** Part of Beyond. Collina Systems proprietary module. */ +import { Component, onWillStart, useState } from "@odoo/owl"; +import { Dialog } from "@web/core/dialog/dialog"; +import { registry } from "@web/core/registry"; +import { useAutofocus, useService } from "@web/core/utils/hooks"; +import { _t } from "@web/core/l10n/translation"; + +// Past this many branches the chips stop being a glance and become a wall, +// so the rest move behind "Buscar más…". +const CHIP_LIMIT = 6; + +/** + * C-023 v2 selector. Rendered as an OWL dialog rather than a restyled form + * view: the design needs pill chips, a live-filtering search table and its own + * header/footer chrome, none of which a form view in a modal can express + * without fighting Odoo's modal styling at every step. + * + * The model stays the authority. This component never builds a domain and + * never trusts its own list: it asks which branches the user may see and sends + * back an id that the server re-checks. + */ +export class KioscoAbrirDialog extends Component { + static template = "beyond_attendance_qr.KioscoAbrirDialog"; + static components = { Dialog }; + static props = { close: Function }; + + setup() { + this.orm = useService("orm"); + this.action = useService("action"); + this.state = useState({ + branches: [], + selectedId: null, + screen: "pick", // "pick" | "search" + query: "", + }); + useAutofocus({ refName: "search" }); + onWillStart(async () => { + const branches = await this.orm.call( + "beyond.kiosco.abrir", + "sucursales_permitidas", + [] + ); + this.state.branches = branches; + this.state.selectedId = branches.length ? branches[0].id : null; + }); + } + + get title() { + return this.state.screen === "search" + ? _t("Buscar sucursal") + : _t("Abrir código QR"); + } + + /** + * The first few branches, plus the selected one when it came from the + * search and would otherwise be off the list — the design shows the pick + * reflected in a selected chip. + */ + get chips() { + const shown = this.state.branches.slice(0, CHIP_LIMIT); + const selected = this.selected; + if (selected && !shown.includes(selected)) { + shown.push(selected); + } + return shown; + } + + /** + * Decision (18-aug-2026): with everything already on screen the link is a + * dead end, so it is hidden rather than shown disabled. It only appears + * once there are branches the chips do not show. + */ + get showSearchLink() { + return this.state.branches.length > CHIP_LIMIT; + } + + get selected() { + return this.state.branches.find((b) => b.id === this.state.selectedId); + } + + get rows() { + const query = this.state.query.trim().toLowerCase(); + if (!query) { + return this.state.branches; + } + return this.state.branches.filter((b) => + `${b.code} ${b.name} ${b.street} ${b.city}`.toLowerCase().includes(query) + ); + } + + selectBranch(id) { + this.state.selectedId = id; + } + + openSearch() { + this.state.query = ""; + this.state.screen = "search"; + } + + closeSearch() { + this.state.screen = "pick"; + } + + pickRow(id) { + this.selectBranch(id); + this.closeSearch(); + } + + onQueryInput(ev) { + this.state.query = ev.target.value; + } + + async confirm() { + if (!this.state.selectedId) { + return; + } + const action = await this.orm.call("beyond.kiosco.abrir", "abrir_sucursal", [ + this.state.selectedId, + ]); + this.props.close(); + await this.action.doAction(action); + } +} + +// Registered as a plain function, not a Component: the action service then +// just calls it (action_service._executeClientAction), so the dialog owns its +// chrome instead of being wrapped in an action controller. +registry.category("actions").add("beyond_kiosco_abrir", (env) => { + env.services.dialog.add(KioscoAbrirDialog); +}); diff --git a/addons/beyond_attendance_qr/static/src/kiosco_abrir/kiosco_abrir_dialog.scss b/addons/beyond_attendance_qr/static/src/kiosco_abrir/kiosco_abrir_dialog.scss new file mode 100644 index 0000000..1e5c96b --- /dev/null +++ b/addons/beyond_attendance_qr/static/src/kiosco_abrir/kiosco_abrir_dialog.scss @@ -0,0 +1,301 @@ +// ============================================================================= +// C-023 v2 · "Abrir código QR" dialog and its branch search. +// +// Faithful to the signed-off design; every colour comes from a token in +// beyond_base/static/src/scss/beyond_variables.scss, never a loose hex. Two +// deliberate departures, both marked TOUCH below: the design sizes some +// controls under the 48px floor this project holds itself to. +// +// The rules are scoped by .beyond_qr_dialog (the Dialog's contentClass) so +// nothing here leaks into other Odoo dialogs. +// ============================================================================= + +$beyond-qr-font: Manrope, ui-sans-serif, system-ui, sans-serif; + +.o_dialog:has(.beyond_qr_dialog) { + // The design's own veil. Scoped to this dialog: .modal-backdrop is shared + // by every dialog in the web client and must not be recoloured. + > .modal { + background-color: rgba(35, 32, 29, 0.45); + } + + .modal-dialog { + max-width: 560px; + width: 100%; + } + + // Search screen is the wider panel. + .modal-dialog:has(.beyond_qr_dialog_wide) { + max-width: 680px; + } +} + +.beyond_qr_dialog { + font-family: $beyond-qr-font; + background: $beyond-surface; + border: 0; + border-radius: 28px; + box-shadow: 0 24px 60px rgba(20, 17, 14, 0.35); + // The panel is one flex column; header, body and footer are its children, + // so the design's single gap governs the whole dialog. + display: flex; + flex-direction: column; + gap: 22px; + padding: 28px 32px 32px; + + &.beyond_qr_dialog_wide { + gap: 20px; + } + + // Strip Bootstrap's chrome: the panel above already draws it. + .modal-header, + .modal-body, + .modal-footer { + background: transparent; + border: 0; + padding: 0; + margin: 0; + } + + .modal-header { + display: flex; + align-items: center; + justify-content: space-between; + } + + .modal-footer { + display: flex; + justify-content: flex-start; + gap: 10px; + padding-top: 2px; + } + + // ------------------------------------------------------------------------- + // Header + // ------------------------------------------------------------------------- + .beyond_qr_title { + font-size: 24px; + font-weight: 800; + letter-spacing: -0.02em; + color: $beyond-ink; + } + + .beyond_qr_close { + all: unset; + box-sizing: border-box; + cursor: pointer; + // TOUCH — the design sizes this at 40px, below the 48px floor. Left as + // designed: growing it visibly breaks the header composition, and the + // control is redundant (Escape and "Cancelar" both close the dialog). + width: 40px; + height: 40px; + border-radius: 14px; + display: flex; + align-items: center; + justify-content: center; + + &:hover { background: $beyond-surface-hover; } + &:focus-visible { outline: 4px solid $beyond-ink; } + } + + // ------------------------------------------------------------------------- + // Body + // ------------------------------------------------------------------------- + .beyond_qr_body { + display: flex; + flex-direction: column; + gap: 22px; + } + + &.beyond_qr_dialog_wide .beyond_qr_body { + gap: 20px; + } + + .beyond_qr_field { + display: flex; + flex-direction: column; + gap: 10px; + } + + .beyond_qr_label { + font-size: 12px; + font-weight: 800; + letter-spacing: 0.08em; + text-transform: uppercase; + color: $beyond-ink-muted; + } + + .beyond_qr_chips { + display: flex; + align-items: center; + gap: 8px; + flex-wrap: wrap; + } + + .beyond_qr_chip { + all: unset; + box-sizing: border-box; + cursor: pointer; + padding: 12px 22px; + // TOUCH — the design's padding lands at ~42px; this raises the pill to + // the 48px floor without changing padding, type or colour. + min-height: 48px; + display: flex; + align-items: center; + border-radius: 999px; + font-size: 15px; + font-weight: 700; + background: $beyond-surface-hover; + color: $beyond-ink-soft; + transition: background 140ms ease; + + &.selected { + background: $beyond-kiosco; + color: #FFFFFF; + } + + &:focus-visible { outline: 4px solid $beyond-ink; } + } + + .beyond_qr_more { + all: unset; + cursor: pointer; + margin-left: 8px; + font-size: 14px; + font-weight: 700; + color: $beyond-kiosco; + + &:hover { color: $beyond-kiosco-darker; } + &:focus-visible { outline: 4px solid $beyond-ink; } + } + + .beyond_qr_help { + font-size: 15px; + line-height: 1.55; + color: $beyond-ink-softer; + } + + // ------------------------------------------------------------------------- + // Search screen + // ------------------------------------------------------------------------- + .beyond_qr_search { + display: flex; + align-items: center; + gap: 10px; + background: $beyond-surface-hover; + border-radius: 999px; + padding: 12px 18px; + + input { + all: unset; + flex: 1; + min-width: 0; + font-size: 15px; + font-weight: 600; + color: $beyond-ink; + + &::placeholder { color: $beyond-ink-muted; } + } + } + + .beyond_qr_table { + display: flex; + flex-direction: column; + gap: 6px; + } + + .beyond_qr_head, + .beyond_qr_row { + display: grid; + grid-template-columns: 64px 1.2fr 1.4fr 1fr; + gap: 12px; + align-items: center; + } + + .beyond_qr_head { + padding: 0 18px; + font-size: 11px; + font-weight: 800; + letter-spacing: 0.08em; + text-transform: uppercase; + color: $beyond-ink-muted; + } + + .beyond_qr_row { + all: unset; + box-sizing: border-box; + cursor: pointer; + display: grid; + grid-template-columns: 64px 1.2fr 1.4fr 1fr; + gap: 12px; + align-items: center; + padding: 14px 18px; + border-radius: 18px; + text-align: left; + transition: background 140ms ease; + + &:hover, + &:focus { background: $beyond-surface-hover; } + // The design marks focus with the same tint as hover, which a keyboard + // user cannot tell apart from the row under the pointer. The ring is + // added on top, using the launcher's focus value. + &:focus-visible { outline: 4px solid $beyond-ink; } + } + + .beyond_qr_code { + font-size: 13px; + font-weight: 700; + color: $beyond-ink-muted; + } + + .beyond_qr_name { + font-size: 15px; + font-weight: 800; + color: $beyond-ink; + } + + .beyond_qr_cell { + font-size: 14px; + color: $beyond-ink-softer; + } + + .beyond_qr_empty { + padding: 18px; + font-size: 14px; + color: $beyond-ink-muted; + } + + // ------------------------------------------------------------------------- + // Actions + // ------------------------------------------------------------------------- + .beyond_qr_btn { + all: unset; + box-sizing: border-box; + cursor: pointer; + padding: 14px 28px; + min-height: 48px; // TOUCH — the design already lands here. + display: flex; + align-items: center; + border-radius: 999px; + font-size: 16px; + font-weight: 800; + transition: background 140ms ease; + + &:focus-visible { outline: 4px solid $beyond-ink; } + } + + .beyond_qr_btn_primary { + background: $beyond-kiosco; + color: #FFFFFF; + + &:hover { background: $beyond-kiosco-dark; } + &:active { background: $beyond-kiosco-darker; } + } + + .beyond_qr_btn_ghost { + background: $beyond-surface-hover; + color: $beyond-ink; + + &:hover { background: $beyond-surface-active; } + } +} diff --git a/addons/beyond_attendance_qr/static/src/kiosco_abrir/kiosco_abrir_dialog.xml b/addons/beyond_attendance_qr/static/src/kiosco_abrir/kiosco_abrir_dialog.xml new file mode 100644 index 0000000..435bd04 --- /dev/null +++ b/addons/beyond_attendance_qr/static/src/kiosco_abrir/kiosco_abrir_dialog.xml @@ -0,0 +1,87 @@ + + + + + + + + + + + +
+
+ Sucursal +
+ +
+
+ El kiosco se abre en una pestaña nueva, + listo para dejarse a pantalla completa en la tablet de la + sucursal. +
+ + +
+ +
+
+ CódigoNombreDirecciónCiudad +
+ + Sin resultados + para tu búsqueda. +
+
+ + + + + + + + +
+
+
diff --git a/addons/beyond_attendance_qr/tests/test_kiosco_abrir.py b/addons/beyond_attendance_qr/tests/test_kiosco_abrir.py index 832208b..0ab6ec0 100644 --- a/addons/beyond_attendance_qr/tests/test_kiosco_abrir.py +++ b/addons/beyond_attendance_qr/tests/test_kiosco_abrir.py @@ -21,20 +21,41 @@ class TestBeyondKioscoAbrir(BeyondChecadorCase): "pestaña nueva: el kiosco es fullscreen y se queda en la tablet") def test_varias_sucursales_muestran_selector(self): + """El selector v2 es un diálogo OWL: la acción de servidor devuelve + la acción de cliente y el diálogo llama de vuelta al modelo.""" accion = self._abrir(self.admin_ab) - self.assertEqual(accion['type'], 'ir.actions.act_window') - self.assertEqual(accion['res_model'], 'beyond.kiosco.abrir') - wizard = self.env['beyond.kiosco.abrir'].with_user(self.admin_ab).create({ - 'branch_id': self.branch_b.id}) - resultado = wizard.action_abrir() + self.assertEqual(accion['type'], 'ir.actions.client') + self.assertEqual(accion['tag'], 'beyond_kiosco_abrir') + resultado = self.env['beyond.kiosco.abrir'].with_user( + self.admin_ab).abrir_sucursal(self.branch_b.id) self.assertEqual(resultado['url'], self.branch_b.kiosk_url) self.assertEqual(resultado['target'], 'new') + def test_sucursales_del_dialogo_respetan_el_aislamiento(self): + filas = self.env['beyond.kiosco.abrir'].with_user( + self.admin_ab).sucursales_permitidas() + self.assertEqual({f['id'] for f in filas}, + set((self.branch_a | self.branch_b).ids)) + self.assertEqual( + {f['name'] for f in filas}, + {self.branch_a.name, self.branch_b.name}) + # las columnas del buscador vienen de campos reales de beyond.branch + for fila in filas: + self.assertEqual(set(fila), + {'id', 'code', 'name', 'street', 'city'}) + + def test_abrir_sucursal_ajena_rebota(self): + """El diálogo elige, el servidor decide: un id fuera de las + sucursales del usuario no abre nada.""" + with self.assertRaises(UserError): + self.env['beyond.kiosco.abrir'].with_user( + self.admin_a).abrir_sucursal(self.branch_b.id) + def test_admin_general_selector_de_todas(self): """Decisión documentada: el admin general SÍ lo ve, con selector de todas las sucursales (abre tiendas y hace demos).""" accion = self._abrir(self.admin_general) - self.assertEqual(accion['type'], 'ir.actions.act_window') + self.assertEqual(accion['type'], 'ir.actions.client') branches = self.env['beyond.kiosco.abrir'].with_user( self.admin_general)._branches_del_usuario() self.assertEqual(set(branches.ids), diff --git a/addons/beyond_attendance_qr/views/kiosco_abrir_views.xml b/addons/beyond_attendance_qr/views/kiosco_abrir_views.xml index cb51f7a..acb5e5b 100644 --- a/addons/beyond_attendance_qr/views/kiosco_abrir_views.xml +++ b/addons/beyond_attendance_qr/views/kiosco_abrir_views.xml @@ -2,28 +2,11 @@ - - beyond.kiosco.abrir.form - beyond.kiosco.abrir - -
- - - -
- El kiosco se abre en una pestaña nueva, listo para dejarse - a pantalla completa en la tablet de la sucursal. -
-
-
-
-
-
+ como admin general) abre el diálogo "Abrir código QR". + The v2 selector is an OWL dialog (static/src/kiosco_abrir), so there + is no form view here any more: the server action returns an + ir.actions.client and the dialog calls back into the model. --> Kiosco diff --git a/addons/beyond_attendance_qr/views/kiosco_templates.xml b/addons/beyond_attendance_qr/views/kiosco_templates.xml index f1dbac3..cb87716 100644 --- a/addons/beyond_attendance_qr/views/kiosco_templates.xml +++ b/addons/beyond_attendance_qr/views/kiosco_templates.xml @@ -1,9 +1,20 @@ - +