From c560cba1eb594731d8b41e2628b1442391e34c6e Mon Sep 17 00:00:00 2001 From: Suherdy Yacob Date: Fri, 5 Jun 2026 17:00:05 +0700 Subject: [PATCH] feat: implement automatic register unlock and maintain order screen focus after order submission --- README.md | 2 ++ __manifest__.py | 4 +++- .../app/screens/login_screen/login_screen.js | 24 +++++++++++++++++++ static/src/app/services/pos_store.js | 9 ++++++- 4 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 static/src/app/screens/login_screen/login_screen.js diff --git a/README.md b/README.md index 4315de8..bb7448b 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,8 @@ This Odoo 19 module enhances the security and auditability of the Point of Sale - **UI Streamlining - Button Renaming**: Renames the "Basic Receipt" button to "Table Checker" (on both the action pad and print success screen) for clearer pre-payment table verification. - **Automatic Table Checker on Send**: Automatically prints a "Table Checker" (Basic Receipt) whenever the employee clicks the kitchen "Send" button to submit changes. - **Incremental Printing on Send**: When additional items are added to an already sent order, the automatic print on "Send" is filtered to print *only the newly added (additional) items*, preventing duplicate printing of already served items. +- **Unlock Register PIN/Selection Bypass**: Bypasses the PIN prompt and employee selection when unlocking/opening the register. It unlocks directly with the current/last cashier since actions (table selection, payment, loading order, register order) are already PIN-protected. +- **Stay on Current Order on Send**: Retains the POS UI on the current table/order screen after clicking "Send" rather than returning to the Floor Screen (table view). ## Dependencies diff --git a/__manifest__.py b/__manifest__.py index 42d25a4..dbade91 100644 --- a/__manifest__.py +++ b/__manifest__.py @@ -1,6 +1,6 @@ { 'name': 'POS Custom Employee Access', - 'version': '19.0.0.0.2', + 'version': '19.0.0.0.3', 'category': 'Point of Sale', 'summary': 'Enhanced POS access control and employee tracking', 'description': """ @@ -12,6 +12,8 @@ - Hide "Transfer Course" button on POS UI - Hide "Save Order for Later" (upload) button on POS UI - Rename "Basic Receipt" to "Table Checker" + - Bypass PIN code and employee selection on Unlock Register + - Stay on the current order/table after clicking Send """, 'author': 'Suherdy Yacob', 'depends': ['pos_restaurant', 'pos_hr', 'pos_employee_role'], diff --git a/static/src/app/screens/login_screen/login_screen.js b/static/src/app/screens/login_screen/login_screen.js new file mode 100644 index 0000000..d2fa538 --- /dev/null +++ b/static/src/app/screens/login_screen/login_screen.js @@ -0,0 +1,24 @@ +/** @odoo-module */ + +import { LoginScreen } from "@point_of_sale/app/screens/login_screen/login_screen"; +import { patch } from "@web/core/utils/patch"; + +patch(LoginScreen.prototype, { + async openRegister() { + if (!this.pos.config.module_pos_hr) { + super.openRegister(); + return; + } + + const currentCashier = this.pos.getCashier(); + if (currentCashier) { + this.cashierLogIn(); + } else { + const allEmployees = this.pos.models["hr.employee"].getAll(); + if (allEmployees.length) { + this.pos.setCashier(allEmployees[0]); + } + this.cashierLogIn(); + } + } +}); diff --git a/static/src/app/services/pos_store.js b/static/src/app/services/pos_store.js index 73c3f3a..cb7ab35 100644 --- a/static/src/app/services/pos_store.js +++ b/static/src/app/services/pos_store.js @@ -180,7 +180,14 @@ patch(PosStore.prototype, { } } - const res = await super.submitOrder(...arguments); + const originalShowDefault = this.showDefault; + this.showDefault = () => {}; + let res; + try { + res = await super.submitOrder(...arguments); + } finally { + this.showDefault = originalShowDefault; + } if (order && this.config.basic_receipt) { if (orderProxy) {