feat(shopfloor): /fp/tablet/tiles returns session_mode + kiosk_uid

OWL lock screen needs to know (a) the active session mode (legacy or
session_swap) to branch between endpoints, and (b) the kiosk uid to
determine 'is the current browser session the kiosk?' Both come from
the bootstrap response so no extra round-trips on every render.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-05-24 13:14:41 -04:00
parent 8f6302b446
commit 10477a7c8f

View File

@@ -498,10 +498,24 @@ class FpTabletController(http.Controller):
})
# Clocked-in first, then alphabetical within bucket
tiles.sort(key=lambda t: (not t['is_clocked_in'], t['name']))
# Phase D bootstrap: lock screen needs the feature flag + kiosk
# uid so it knows whether to call /unlock (legacy) or
# /unlock_session (new), and whether the current session is
# the kiosk's (= no tech logged in).
ICP = env['ir.config_parameter'].sudo()
session_mode = ICP.get_param('fp.shopfloor.tablet_session_mode', 'legacy')
kiosk = env.ref(
'fusion_plating_shopfloor.user_fp_tablet_kiosk',
raise_if_not_found=False,
)
kiosk_uid = kiosk.id if kiosk else None
return {
'ok': True,
'company': _lock_company_payload(request.env),
'tiles': tiles,
'tablet_session_mode': session_mode,
'kiosk_uid': kiosk_uid,
'current_uid': request.env.uid,
}
# ======================================================================