Go to file
2026-05-07 16:58:20 +07:00
models First Commit 2026-05-07 15:33:20 +07:00
static/src/app feat: grant outlet managers bypass authority for restricted POS actions and prevent order deletion when items are locked 2026-05-07 16:58:20 +07:00
__init__.py First Commit 2026-05-07 15:33:20 +07:00
__manifest__.py feat: grant outlet managers bypass authority for restricted POS actions and prevent order deletion when items are locked 2026-05-07 16:58:20 +07:00
.gitignore First Commit 2026-05-07 15:33:20 +07:00
README.rst feat: grant outlet managers bypass authority for restricted POS actions and prevent order deletion when items are locked 2026-05-07 16:58:20 +07:00

========================
POS Lock Sent Products
========================

This module implements a robust security lock in the Odoo 19 Point of Sale system to prevent unauthorized deletion or reduction of order lines that have already been sent to the kitchen (Preparation).

Features
========

* **Role-Based Security**: Only users with the "Area Manager" or "Store Manager" (technically "outlet_manager") roles can delete or reduce the quantity of items already sent to the kitchen.
* **Persistent Locking**: Uses a database-backed field `x_locked_qty` on `pos.order.line` to ensure the lock state persists across browser refreshes, device synchronizations, and session restarts.
* **Graceful Reduction**: Allows cashiers to freely add and remove "new" quantities on an existing line. For example, if 1 item is sent and 1 is newly added (Total 2), the cashier can safely backspace to reduce the quantity to 1, but cannot drop it below the sent amount.
* **User-Friendly Alerts**: Displays a clear "Action Restricted" popup when an unauthorized deletion attempt is blocked.

Technical Details
=================

* **Models Patched**:
    * ``pos.order.line``: Added ``x_locked_qty`` to store the snapshot of the quantity at the moment of kitchen preparation.
* **Javascript Patches**:
    * ``PosOrderline``: Enforces quantity checks in ``setQuantity`` using both Odoo's native ``mp_qty`` and the custom ``x_locked_qty``.
    * ``PosOrder``: Intercepts ``removeOrderline`` to block full line deletions and captures snapshots during ``updateLastOrderChange``.
    * ``OrderSummary``: Intercepts the UI "Remove" action to ensure the security alert is correctly displayed to the user.

Dependencies
============

* ``point_of_sale``
* ``pos_employee_role``

Installation
============

1. Install the module as usual.
2. Ensure the "Area Manager" or "Store Manager" roles are configured for supervisors who require bypass authority.
3. Refresh the POS interface to load the new security logic.