Rediseña la pantalla del kiosco y el selector de sucursal
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) <noreply@anthropic.com>
This commit is contained in:
1 parent
07a13b7ca2
commit
16398c7cf1
9 files changed
+687
-76
No files matched your search
@@ -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,
|
||||
|
||||
@@ -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/<string:token>/estado', type='http',
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates xml:space="preserve">
|
||||
<!--
|
||||
C-023 v2 · "Abrir código QR". One dialog, two screens (chips / search),
|
||||
exactly as the design models them: they are never shown at once, so
|
||||
stacking a second modal would only add chrome to fight.
|
||||
-->
|
||||
<t t-name="beyond_attendance_qr.KioscoAbrirDialog">
|
||||
<Dialog
|
||||
size="'md'"
|
||||
technical="false"
|
||||
withBodyPadding="false"
|
||||
title="title"
|
||||
contentClass="state.screen === 'search' ? 'beyond_qr_dialog beyond_qr_dialog_wide' : 'beyond_qr_dialog'"
|
||||
>
|
||||
<t t-set-slot="header">
|
||||
<span class="beyond_qr_title" t-esc="title"/>
|
||||
<button class="beyond_qr_close" aria-label="Cerrar"
|
||||
t-on-click="() => this.props.close()">
|
||||
<svg width="16" height="16" viewBox="0 0 18 18" aria-hidden="true">
|
||||
<path d="M2 2l14 14M16 2L2 16" stroke="#4A453E" stroke-width="2.5" stroke-linecap="round"/>
|
||||
</svg>
|
||||
</button>
|
||||
</t>
|
||||
|
||||
<!-- ── Screen: pick a branch ── -->
|
||||
<div t-if="state.screen === 'pick'" class="beyond_qr_body">
|
||||
<div class="beyond_qr_field">
|
||||
<span class="beyond_qr_label">Sucursal</span>
|
||||
<div class="beyond_qr_chips">
|
||||
<button t-foreach="chips" t-as="branch" t-key="branch.id"
|
||||
class="beyond_qr_chip"
|
||||
t-att-class="{ selected: branch.id === state.selectedId }"
|
||||
t-att-aria-pressed="branch.id === state.selectedId ? 'true' : 'false'"
|
||||
t-on-click="() => this.selectBranch(branch.id)"
|
||||
t-esc="branch.name"/>
|
||||
<button t-if="showSearchLink" class="beyond_qr_more"
|
||||
t-on-click="openSearch">Buscar más…</button>
|
||||
</div>
|
||||
</div>
|
||||
<span class="beyond_qr_help">El kiosco se abre en una pestaña nueva,
|
||||
listo para dejarse a pantalla completa en la tablet de la
|
||||
sucursal.</span>
|
||||
</div>
|
||||
|
||||
<!-- ── Screen: search every branch the user may open ── -->
|
||||
<div t-else="" class="beyond_qr_body">
|
||||
<div class="beyond_qr_search">
|
||||
<svg width="17" height="17" viewBox="0 0 20 20" aria-hidden="true">
|
||||
<circle cx="8.5" cy="8.5" r="6" stroke="#7A736A" stroke-width="2.4" fill="none"/>
|
||||
<path d="M13 13l5 5" stroke="#7A736A" stroke-width="2.4" stroke-linecap="round"/>
|
||||
</svg>
|
||||
<input type="text" t-ref="search" t-att-value="state.query"
|
||||
t-on-input="onQueryInput"
|
||||
placeholder="Buscar por nombre o ciudad…"
|
||||
aria-label="Buscar sucursal"/>
|
||||
</div>
|
||||
<div class="beyond_qr_table">
|
||||
<div class="beyond_qr_head">
|
||||
<span>Código</span><span>Nombre</span><span>Dirección</span><span>Ciudad</span>
|
||||
</div>
|
||||
<button t-foreach="rows" t-as="branch" t-key="branch.id"
|
||||
class="beyond_qr_row"
|
||||
t-on-click="() => this.pickRow(branch.id)">
|
||||
<span class="beyond_qr_code" t-esc="branch.code"/>
|
||||
<span class="beyond_qr_name" t-esc="branch.name"/>
|
||||
<span class="beyond_qr_cell" t-esc="branch.street"/>
|
||||
<span class="beyond_qr_cell" t-esc="branch.city"/>
|
||||
</button>
|
||||
<span t-if="!rows.length" class="beyond_qr_empty">Sin resultados
|
||||
para tu búsqueda.</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<t t-set-slot="footer">
|
||||
<t t-if="state.screen === 'pick'">
|
||||
<button class="beyond_qr_btn beyond_qr_btn_primary"
|
||||
t-on-click="confirm">Abrir código QR</button>
|
||||
<button class="beyond_qr_btn beyond_qr_btn_ghost"
|
||||
t-on-click="() => this.props.close()">Cancelar</button>
|
||||
</t>
|
||||
<button t-else="" class="beyond_qr_btn beyond_qr_btn_ghost"
|
||||
t-on-click="closeSearch">Cerrar</button>
|
||||
</t>
|
||||
</Dialog>
|
||||
</t>
|
||||
</templates>
|
||||
@@ -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),
|
||||
|
||||
@@ -2,28 +2,11 @@
|
||||
<odoo>
|
||||
<!-- C-023: app "Kiosco" en el lanzador. Un toque: con una sucursal
|
||||
asignada abre su kiosco directo en pestaña nueva; con varias (o
|
||||
como admin general) muestra el selector. -->
|
||||
<record id="view_kiosco_abrir_form" model="ir.ui.view">
|
||||
<field name="name">beyond.kiosco.abrir.form</field>
|
||||
<field name="model">beyond.kiosco.abrir</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Abrir kiosco">
|
||||
<group>
|
||||
<field name="branch_id" options="{'no_create': True, 'no_open': True}"/>
|
||||
</group>
|
||||
<div class="text-muted">
|
||||
El kiosco se abre en una pestaña nueva, listo para dejarse
|
||||
a pantalla completa en la tablet de la sucursal.
|
||||
</div>
|
||||
<footer>
|
||||
<button name="action_abrir" type="object" string="Abrir kiosco"
|
||||
class="btn-primary"/>
|
||||
<button string="Cancelar" special="cancel"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
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. -->
|
||||
<record id="action_servidor_kiosco" model="ir.actions.server">
|
||||
<field name="name">Kiosco</field>
|
||||
<field name="model_id" ref="model_beyond_kiosco_abrir"/>
|
||||
|
||||
@@ -1,9 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<!-- Pantalla del kiosco (tablet fija por sucursal, C-012). Página
|
||||
standalone: sin layout del portal, pensada para quedarse abierta
|
||||
todo el día a pantalla completa. El JS solo PINTA lo que el backend
|
||||
decide (regla §10.6): consulta /estado y actualiza QR o estado. -->
|
||||
<!-- Kiosk screen v2 (branch tablet, C-012). Standalone page: no portal
|
||||
layout, meant to stay open all day in full screen. The JS only
|
||||
PAINTS what the backend decides (spec §10.6): it polls /estado and
|
||||
swaps the open/closed blocks with the `hidden` attribute.
|
||||
|
||||
PIN link removed by design decision (18-aug-2026); full PIN removal
|
||||
pending backend task.
|
||||
|
||||
Colours and type come from the signed-off design. This page is
|
||||
public and never receives the backend SCSS bundle, so the tokens are
|
||||
restated here as CSS custom properties — source of truth is
|
||||
beyond_base/static/src/scss/beyond_variables.scss. Manrope is served
|
||||
from the woff2 self-hosted in beyond_base (no Google Fonts: branch
|
||||
terminals must work with no internet); only the latin ranges ship,
|
||||
which is what Spanish needs. -->
|
||||
<template id="kiosco_page" name="Kiosco Beyond">
|
||||
<t t-set="titulo" t-value="'Checador · %s' % branch.name"/>
|
||||
<html lang="es">
|
||||
@@ -13,47 +24,103 @@
|
||||
<meta name="robots" content="noindex"/>
|
||||
<title t-out="titulo"/>
|
||||
<style>
|
||||
@font-face {
|
||||
font-family: 'Manrope';
|
||||
font-style: normal;
|
||||
font-weight: 500 800;
|
||||
font-display: swap;
|
||||
src: url('/beyond_base/static/fonts/manrope-latin-ext.woff2') format('woff2');
|
||||
unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'Manrope';
|
||||
font-style: normal;
|
||||
font-weight: 500 800;
|
||||
font-display: swap;
|
||||
src: url('/beyond_base/static/fonts/manrope-latin.woff2') format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
|
||||
:root {
|
||||
--beyond-kiosco: #8C4A72;
|
||||
--beyond-on-kiosco: #FFFFFF;
|
||||
--beyond-on-kiosco-muted: rgba(255, 255, 255, 0.75);
|
||||
--beyond-kiosco-veil: rgba(255, 255, 255, 0.12);
|
||||
}
|
||||
|
||||
* { box-sizing: border-box; margin: 0; }
|
||||
body {
|
||||
font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
|
||||
background: #0a4a40; color: #fff; min-height: 100vh;
|
||||
display: flex; flex-direction: column; align-items: center;
|
||||
justify-content: center; gap: 1.5rem; padding: 2rem;
|
||||
text-align: center;
|
||||
font-family: Manrope, ui-sans-serif, system-ui, sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
background: var(--beyond-kiosco);
|
||||
color: var(--beyond-on-kiosco);
|
||||
min-height: 100vh;
|
||||
display: flex; flex-direction: column;
|
||||
align-items: center; justify-content: center;
|
||||
gap: 24px; padding: 24px; text-align: center;
|
||||
}
|
||||
.branch { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; }
|
||||
/* Both states share the shell: branch name, a card, a text
|
||||
stack — same rhythm open or closed. */
|
||||
.estado {
|
||||
display: flex; flex-direction: column;
|
||||
align-items: center; gap: 24px;
|
||||
}
|
||||
h1 { font-size: 1.6rem; font-weight: 600; opacity: .95; }
|
||||
.qr-card {
|
||||
background: #fff; border-radius: 1.5rem; padding: 1.5rem;
|
||||
box-shadow: 0 10px 40px rgba(0,0,0,.35);
|
||||
background: #FFFFFF; border-radius: 32px; padding: 32px;
|
||||
box-shadow: 0 24px 60px rgba(58, 24, 45, 0.45);
|
||||
}
|
||||
.qr-card img { display: block; width: min(60vw, 420px); height: auto; }
|
||||
.instruccion { font-size: 1.35rem; max-width: 26rem; line-height: 1.35; }
|
||||
.cerrado { font-size: 1.6rem; max-width: 26rem; line-height: 1.4; }
|
||||
.cerrado .emoji { font-size: 4rem; display: block; margin-bottom: 1rem; }
|
||||
.pin { position: fixed; bottom: 1rem; right: 1rem; font-size: .95rem; }
|
||||
.pin a { color: #ffd; opacity: .75; }
|
||||
.qr-card img {
|
||||
display: block;
|
||||
width: min(50vh, 400px); height: min(50vh, 400px);
|
||||
}
|
||||
.moon-card {
|
||||
width: 176px; height: 176px;
|
||||
background: var(--beyond-kiosco-veil);
|
||||
border-radius: 32px;
|
||||
display: flex; align-items: center; justify-content: center;
|
||||
}
|
||||
.stack { display: flex; flex-direction: column; align-items: center; gap: 6px; }
|
||||
.headline { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; }
|
||||
.copy { font-size: 21px; line-height: 1.4; max-width: 560px; }
|
||||
.hint { font-size: 15px; color: var(--beyond-on-kiosco-muted); }
|
||||
[hidden] { display: none !important; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1 t-out="branch.name"/>
|
||||
<div id="abierto" t-att-hidden="None if estado.get('abierto') else 'hidden'">
|
||||
<span class="branch" t-out="branch.name"/>
|
||||
|
||||
<div id="abierto" class="estado"
|
||||
t-att-hidden="None if estado.get('abierto') else 'hidden'">
|
||||
<div class="qr-card">
|
||||
<img id="qr" t-att-src="estado.get('qr_img')" alt="Código QR para checar"/>
|
||||
</div>
|
||||
<p class="instruccion">Escanea con la cámara de tu celular
|
||||
para checar tu <b>entrada</b> o <b>salida</b>.<br/>
|
||||
<small>El código se renueva solo.</small></p>
|
||||
<div class="stack">
|
||||
<span class="copy">Escanea con la cámara de tu celular
|
||||
para checar tu <strong>entrada</strong> o
|
||||
<strong>salida</strong>.</span>
|
||||
<span class="hint">El código se renueva solo.</span>
|
||||
</div>
|
||||
</div>
|
||||
<div id="cerrado" class="cerrado" t-att-hidden="'hidden' if estado.get('abierto') else None">
|
||||
<span class="emoji">🌙</span>
|
||||
<b>Checado cerrado</b><br/>
|
||||
Fuera del horario de checado. La pantalla se reactivará
|
||||
sola al abrir la ventana.
|
||||
|
||||
<div id="cerrado" class="estado"
|
||||
t-att-hidden="'hidden' if estado.get('abierto') else None">
|
||||
<div class="moon-card">
|
||||
<!-- Same icon language as the launcher: flat white
|
||||
shapes with secondary opacities. -->
|
||||
<svg width="96" height="96" viewBox="0 0 48 48" fill="none" aria-hidden="true">
|
||||
<path d="M40 30.5A17.5 17.5 0 0 1 17.5 8 17.5 17.5 0 1 0 40 30.5Z" fill="#FFFFFF"/>
|
||||
<circle cx="33" cy="12" r="2.6" fill="#FFFFFF" fill-opacity="0.55"/>
|
||||
<circle cx="40.5" cy="19.5" r="1.8" fill="#FFFFFF" fill-opacity="0.55"/>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="stack">
|
||||
<span class="headline">Checado cerrado</span>
|
||||
<span class="copy">Fuera del horario de checado.</span>
|
||||
<span class="hint">La pantalla se reactivará sola al abrir la ventana.</span>
|
||||
</div>
|
||||
</div>
|
||||
<p class="pin" t-if="pin_url">
|
||||
¿Sin celular? <a t-att-href="pin_url">Checa con tu PIN</a>
|
||||
</p>
|
||||
|
||||
<script>
|
||||
(function () {
|
||||
var qr = document.getElementById('qr');
|
||||
|
||||
Reference in new issue
Block a user