metatroncubeswdev db50c3f15c feat(event_qr_ticketing): signed QR tickets + mobile check-in (Phase 2)
Extends stock event.registration with a signed QR ticket system, built to
complement rather than duplicate Odoo 19's existing barcode/badge
infrastructure. ticket_ref ('TIX-{event}-{seq}') and a QR code encoding
"ticket_ref|hmac_token" are added; the HMAC is signed with Odoo's own
per-database secret (ir.config_parameter 'database.secret', the same
mechanism core uses for password-reset tokens), so a copied/edited
ticket_ref without the matching signature is rejected as forged. A "Event
Ticket (QR)" PDF report is auto-attached to the core registration
confirmation email by adding it to event.event_subscription's
report_template_ids - no override of core mail-sending logic needed.

Adds the missing piece core doesn't provide: a mobile-friendly staff
check-in page at /event/checkin (gated on event.group_event_registration_desk),
built as a v19 "Interaction" (registry.category("public.interactions"),
the current replacement for legacy publicWidget) with manual ticket-ref
entry always available and camera scanning via the browser's native
BarcodeDetector API - avoiding a third-party CDN dependency and its
security/offline-reliability tradeoffs. Guards against forged tokens and
double check-in; a live per-event registered-vs-checked-in dashboard.

Two more real Odoo 19 surprises hit here: event.event has no more `state`
field at all (replaced by a stage_id/event.stage kanban system - my
check-in page's event picker now filters by date_end instead), and a
route type='json' should be type='jsonrpc' (json still works but is
deprecated).

Verified against a live Odoo 19 + Postgres 16 container: 9/9 tests pass
(ticket generation/uniqueness, valid/duplicate/forged/tampered token
handling, manual lookup), plus a full manual live run over HTTP - created
an event and registration via JSON-RPC, confirmed ticket_ref generation,
authenticated a session, hit /event/checkin/scan for a real check-in and
duplicate rejection, confirmed dashboard counts update, and loaded the
actual /event/checkin page (title, camera-button markup, and our JS
present in the served frontend bundle).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-17 21:29:40 -04:00

37 lines
1.8 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="checkin_page" name="Event Check-in">
<t t-call="website.layout">
<div class="container o_event_checkin" style="max-width: 480px; margin-top: 24px; margin-bottom: 60px;"
t-att-data-event-id="event.id">
<h2>Event Check-in</h2>
<select class="form-select mb-3 o_checkin_event_select">
<t t-foreach="events" t-as="evt">
<option t-att-value="evt.id" t-att-selected="'selected' if evt.id == event.id else None" t-out="evt.name"/>
</t>
</select>
<div class="mb-3">
<span>Registered: </span><strong class="o_checkin_registered_count">-</strong>
<span> / Checked in: </span><strong class="o_checkin_checked_in_count">-</strong>
</div>
<div class="mb-3">
<label class="form-label">Scan or enter ticket reference</label>
<div class="input-group">
<input type="text" class="form-control o_checkin_input" placeholder="TIX-..." autofocus="autofocus"/>
<button class="btn btn-primary o_checkin_submit" type="button">Check In</button>
</div>
<button class="btn btn-outline-secondary mt-2 o_checkin_camera_btn d-none" type="button">
Scan with Camera
</button>
<video class="o_checkin_camera_video d-none mt-2" style="width: 100%;" autoplay="autoplay" playsinline="playsinline"></video>
</div>
<div class="o_checkin_result" role="status"></div>
</div>
</t>
</template>
</odoo>