diff --git a/addons/laundry_management/static/src/js/ticket_screen_patch.js b/addons/laundry_management/static/src/js/ticket_screen_patch.js new file mode 100644 index 0000000..0a81de6 --- /dev/null +++ b/addons/laundry_management/static/src/js/ticket_screen_patch.js @@ -0,0 +1,26 @@ +/** @odoo-module + * + * TicketScreen patch — gate double-click-to-resume-order through the + * settle-due exit confirmation so cashiers can't silently abandon a + * live settle-due order from the ticket list. + * + * Single-click (onClickOrder) only updates the ticket-list selection + * and does NOT change the active POS order, so it's safe to leave + * untouched. Double-click calls pos.setOrder — our patched setOrder + * also enforces the gate, but doing it here too avoids the flicker + * of partially-switching before the async confirm resolves. + */ +import { patch } from "@web/core/utils/patch"; +import { TicketScreen } from "@point_of_sale/app/screens/ticket_screen/ticket_screen"; + +patch(TicketScreen.prototype, { + async onDblClickOrder(order) { + if (!order?.finalized) { + const allowed = await this.pos.confirmExitSettleIfNeeded(order); + if (!allowed) { + return; + } + } + return super.onDblClickOrder(order); + }, +});