======================== 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" role (integrated with `pos_employee_role`) 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" role is configured for supervisors who require bypass authority. 3. Refresh the POS interface to load the new security logic.