From dd25b27ca678debc12564bb7e3006989397f371b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmoda=E2=80=9D?= Date: Thu, 12 Oct 2023 14:12:02 +0200 Subject: [PATCH] [IMP] pos_restaurant: floor screen order number & current floor Previously, when a table was selected on a floor plan other than the first, clicking on back brought you to the first floor plan, not the one of the previously selected table. Now, when you click on the back button, you return to the floor plan corresponding to the previous table. Also, the order number is now displayed on the floor screen button. closes odoo/odoo#138013 Signed-off-by: Adrien Guilliams (adgu) --- .../orderline/orderline.xml | 6 +----- .../static/tests/tours/PosComboTour.js | 21 +++---------------- .../tours/helpers/ProductScreenTourMethods.js | 3 +-- .../generic_components/OrderWidgetMethods.js | 4 ---- .../static/src/pages/cart_page/cart_page.js | 11 ---------- .../src/app/floor_screen/floor_screen.js | 3 ++- .../src/app/floor_screen/floor_screen.xml | 5 +++-- .../static/src/overrides/models/pos_bus.js | 4 ++++ .../static/src/overrides/models/pos_store.js | 1 + .../components/order_widget/order_widget.js | 4 ++-- .../components/order_widget/order_widget.xml | 4 ++-- .../confirmation_page/confirmation_page.js | 9 -------- .../app/pages/landing_page/landing_page.js | 4 +--- .../app/pages/landing_page/landing_page.xml | 3 ++- 14 files changed, 22 insertions(+), 60 deletions(-) diff --git a/addons/point_of_sale/static/src/app/generic_components/orderline/orderline.xml b/addons/point_of_sale/static/src/app/generic_components/orderline/orderline.xml index 9d98b6d0dbe..ffe5c3e4a2c 100644 --- a/addons/point_of_sale/static/src/app/generic_components/orderline/orderline.xml +++ b/addons/point_of_sale/static/src/app/generic_components/orderline/orderline.xml @@ -2,7 +2,7 @@ -
  • +
  • @@ -19,10 +19,6 @@
  • With a % discount
  • -
  • - - -
  • diff --git a/addons/point_of_sale/static/tests/tours/PosComboTour.js b/addons/point_of_sale/static/tests/tours/PosComboTour.js index 74bd7f8351b..c7302d821a0 100644 --- a/addons/point_of_sale/static/tests/tours/PosComboTour.js +++ b/addons/point_of_sale/static/tests/tours/PosComboTour.js @@ -40,26 +40,11 @@ registry.category("web_tour.tours").add("PosComboPriceTaxIncludedTour", { combo.confirm(), ...ProductScreen.check.selectedOrderlineHas("Office Combo"), ...ProductScreen.do.clickOrderline("Combo Product 3"), - ...ProductScreen.check.selectedOrderlineHas( - "Combo Product 3", - "1.0", - "12.92", - "Office Combo" - ), + ...ProductScreen.check.selectedOrderlineHas("Combo Product 3", "1.0", "12.92"), ...ProductScreen.do.clickOrderline("Combo Product 5"), - ...ProductScreen.check.selectedOrderlineHas( - "Combo Product 5", - "1.0", - "17.87", - "Office Combo" - ), + ...ProductScreen.check.selectedOrderlineHas("Combo Product 5", "1.0", "17.87"), ...ProductScreen.do.clickOrderline("Combo Product 8"), - ...ProductScreen.check.selectedOrderlineHas( - "Combo Product 8", - "1.0", - "28.81", - "Office Combo" - ), + ...ProductScreen.check.selectedOrderlineHas("Combo Product 8", "1.0", "28.81"), // check that you cannot change the quantity of a combo product ...ProductScreen.do.pressNumpad("2"), diff --git a/addons/point_of_sale/static/tests/tours/helpers/ProductScreenTourMethods.js b/addons/point_of_sale/static/tests/tours/helpers/ProductScreenTourMethods.js index 96ad45f2b91..32ff2fca4ca 100644 --- a/addons/point_of_sale/static/tests/tours/helpers/ProductScreenTourMethods.js +++ b/addons/point_of_sale/static/tests/tours/helpers/ProductScreenTourMethods.js @@ -318,7 +318,7 @@ class Check { }, ]; } - selectedOrderlineHas(name, quantity, price, comboParent) { + selectedOrderlineHas(name, quantity, price) { return [ ...adaptForMobile( Order.hasLine({ @@ -326,7 +326,6 @@ class Check { productName: name, quantity, price, - comboParent, }) ), { diff --git a/addons/point_of_sale/static/tests/tours/helpers/generic_components/OrderWidgetMethods.js b/addons/point_of_sale/static/tests/tours/helpers/generic_components/OrderWidgetMethods.js index 4fc811a8dfc..f58f62171bf 100644 --- a/addons/point_of_sale/static/tests/tours/helpers/generic_components/OrderWidgetMethods.js +++ b/addons/point_of_sale/static/tests/tours/helpers/generic_components/OrderWidgetMethods.js @@ -27,7 +27,6 @@ export function hasLine({ quantity, price, customerNote, - comboParent, } = {}) { let trigger = `.order-container .orderline${withClass}`; if (withoutClass) { @@ -45,9 +44,6 @@ export function hasLine({ if (customerNote) { trigger += `:has(.info-list .customer-note:contains("${customerNote}"))`; } - if (comboParent) { - trigger += `:has(.info-list .combo-parent-name:contains("${comboParent}"))`; - } const args = JSON.stringify(arguments[0]); return [ { diff --git a/addons/pos_online_payment_self_order/static/src/pages/cart_page/cart_page.js b/addons/pos_online_payment_self_order/static/src/pages/cart_page/cart_page.js index dccd01542b4..e553c6c9df2 100644 --- a/addons/pos_online_payment_self_order/static/src/pages/cart_page/cart_page.js +++ b/addons/pos_online_payment_self_order/static/src/pages/cart_page/cart_page.js @@ -19,23 +19,12 @@ patch(CartPage.prototype, { const service = this.selfOrder.config.self_ordering_service_mode; const takeAway = this.selfOrder.currentOrder.take_away; - if (this.sendInProgress) { - return; - } - if (!this.selfOrder.table && service === "table" && !takeAway) { this.state.selectTable = true; return; } if (mode === "meal" && isOnlinePayment && order.isSavedOnServer) { - if (!order) { - this.selfOrder.notification.add(_t("The current order is invalid."), { - type: "danger", - }); - return; - } - this.checkAndOpenPaymentPage(order); } else if (mode === "meal" && !isOnlinePayment && order.isSavedOnServer) { this.router.navigate("confirmation", { diff --git a/addons/pos_restaurant/static/src/app/floor_screen/floor_screen.js b/addons/pos_restaurant/static/src/app/floor_screen/floor_screen.js index 8fd59ad6b9f..5ab584e5608 100644 --- a/addons/pos_restaurant/static/src/app/floor_screen/floor_screen.js +++ b/addons/pos_restaurant/static/src/app/floor_screen/floor_screen.js @@ -36,7 +36,7 @@ export class FloorScreen extends Component { this.pos = usePos(); this.popup = useService("popup"); this.orm = useService("orm"); - const floor = this.props.floor || this.pos.floors[0]; + const floor = this.pos.currentFloor; this.state = useState({ selectedFloorId: floor ? floor.id : null, selectedTableIds: [], @@ -334,6 +334,7 @@ export class FloorScreen extends Component { } } selectFloor(floor) { + this.pos.currentFloor = floor; this.state.selectedFloorId = floor.id; this.state.floorBackground = this.activeFloor.background_color; this.state.selectedTableIds = []; diff --git a/addons/pos_restaurant/static/src/app/floor_screen/floor_screen.xml b/addons/pos_restaurant/static/src/app/floor_screen/floor_screen.xml index 7f69f2cb6d0..de822a70f12 100644 --- a/addons/pos_restaurant/static/src/app/floor_screen/floor_screen.xml +++ b/addons/pos_restaurant/static/src/app/floor_screen/floor_screen.xml @@ -3,7 +3,7 @@
    -
    - -