From 3b2a26cb7bac9fb5c497d6ce7ce6c4fee4335e50 Mon Sep 17 00:00:00 2001 From: Jitendra Prajapat Date: Thu, 24 Oct 2024 10:01:17 +0000 Subject: [PATCH] [IMP] pos_restaurant: auto-create floating order from quick table selector Before this commit: ==================== If the number entered on the quick table selector numpad did not match any existing table or floating order, an error message ("No table or floating order found with this number") was displayed. After this commit: ================== When the entered number does not correspond to an existing table or floating order, a new floating order is automatically created using the inputted number. task- 4274465 closes odoo/odoo#187474 X-original-commit: f924488360088aaf057512c84377a2838bab4b68 Related: odoo/enterprise#73951 Signed-off-by: David Monnom (moda) Signed-off-by: Jitendra Kumar Prajapat (jipr) --- .../static/src/overrides/components/navbar/navbar.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/addons/pos_restaurant/static/src/overrides/components/navbar/navbar.js b/addons/pos_restaurant/static/src/overrides/components/navbar/navbar.js index 5cd12998ea9e6..1a291c986862a 100644 --- a/addons/pos_restaurant/static/src/overrides/components/navbar/navbar.js +++ b/addons/pos_restaurant/static/src/overrides/components/navbar/navbar.js @@ -1,7 +1,6 @@ import { Navbar } from "@point_of_sale/app/components/navbar/navbar"; import { patch } from "@web/core/utils/patch"; import { _t } from "@web/core/l10n/translation"; -import { AlertDialog } from "@web/core/confirmation_dialog/confirmation_dialog"; import { getButtons, EMPTY, ZERO, BACKSPACE } from "@point_of_sale/app/components/numpad/numpad"; import { TableSelector } from "./table_selector/table_selector"; @@ -69,11 +68,10 @@ patch(Navbar.prototype, { return this.setFloatingOrder(floating_order); } if (!table && !floating_order) { - this.dialog.add(AlertDialog, { - title: _t("Error"), - body: _t("No table or floating order found with this number"), - }); - return; + const newOrder = this.pos.add_new_order(); + newOrder.floating_order_name = table_number; + newOrder.setBooked(true); + return this.setFloatingOrder(newOrder); } }, });