diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b7fe279 --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# IDE / Editor configuration +.vscode/ +.idea/ +*.swp +*~ + +# Odoo specific +*.pot +*.log diff --git a/README.md b/README.md new file mode 100644 index 0000000..87341f4 --- /dev/null +++ b/README.md @@ -0,0 +1,23 @@ +# 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. + +## 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**: Implements specific overrides in `_check_if_no_draft_orders` and `_set_opening_control_data` inside `pos.session` model. +- Time conversions correctly compare against the user's localized timezone (`self.env.user.tz`). diff --git a/__manifest__.py b/__manifest__.py index 836467a..c0b543d 100644 --- a/__manifest__.py +++ b/__manifest__.py @@ -8,6 +8,7 @@ This module allows cashiers on the morning shift to close the POS session even i Those pending orders will automatically be moved to the next session when it is opened. The afternoon/evening shift will maintain the standard Odoo behavior (blocking closure if pending orders exist). """, + 'author': "Suherdy Yacob", 'depends': ['point_of_sale'], 'data': [ 'views/res_config_settings_views.xml',