Go to file
2026-06-20 22:27:37 +07:00
controllers feat: implement PosController override to redirect users to the POS dashboard when no active session exists 2026-05-21 09:20:36 +07:00
models fix: allow pending orders to be searched across multiple POS configs in pos_session 2026-06-20 22:27:37 +07:00
views first commit 2026-03-20 15:18:52 +07:00
__init__.py feat: implement PosController override to redirect users to the POS dashboard when no active session exists 2026-05-21 09:20:36 +07:00
__manifest__.py feat: Add pos_shift_close module to manage multi-shift POS sessions by bypassing draft order checks and transferring orders. 2026-03-20 15:21:15 +07:00
.gitignore feat: Add pos_shift_close module to manage multi-shift POS sessions by bypassing draft order checks and transferring orders. 2026-03-20 15:21:15 +07:00
README.md feat: implement PosController override to redirect users to the POS dashboard when no active session exists 2026-05-21 09:20:36 +07:00

POS Shift Close

Overview

The pos_shift_close module customizes the Point of Sale session closing behavior in Odoo 19 to accommodate businesses with multiple shifts (e.g., Morning and Afternoon/Night shifts).

By default, Odoo prevents a POS session from closing if there are still unpaid or draft orders. This module introduces a time-based configuration to bypass this restriction for the Morning shift. When the Afternoon shift opens a new session, all draft orders from the Morning shift are automatically transferred over so they can be processed seamlessly.

Key Features

  1. Configurable Shift Cutoff Time: You can set a "Morning Shift End Time" (in float hours, e.g., 15.0 for 3:00 PM) via the POS Configuration menu.
  2. Morning Shift Validation Bypass: If a cashier attempts to close a session before the configured cutoff time, the standard Odoo check for draft orders is bypassed.
  3. Automatic Order Transfer: When the next session (Afternoon shift) is opened for the same POS, the module automatically scans previously closed sessions and moves any remaining draft orders to the newly opened session.
  4. Standard Night Flow Restriction: If a session is closed after the cutoff time (i.e., at the end of the day), the standard Odoo behavior applies, and the session cannot be closed until all pending orders are either paid or cancelled.
  5. Session Closure Redirection Fix: Prevents Odoo from automatically creating and opening a new session immediately after a successful closure by cleanly redirecting the browser back to the backend POS dashboard.

Setup & Configuration

  1. Install the module pos_shift_close on your Odoo 19 instance.
  2. Go to Point of Sale > Configuration > Settings.
  3. Under the Accounting section, locate the new Morning Shift End Time field.
  4. Enter your cutoff time (e.g., 15:00 for 3 PM) and save.

Technical Details

  • Dependency: Requires point_of_sale.
  • Overrides (Python Models): Implements specific overrides in _check_if_no_draft_orders and _set_opening_control_data inside the pos.session model.
  • Overrides (Controllers): Inherits standard Odoo's PosController and overrides the pos_web method/route to intercept direct /pos/ui/<config_id> loads. If there is no active session (has_active_session is False) and the request is not from backend dashboard (from_backend is False), the user is redirected back to the backend.
  • Time conversions correctly compare against the user's localized timezone (self.env.user.tz).