From 0d169166bae63b92672ee8c0f6aa1caa568cf9d5 Mon Sep 17 00:00:00 2001 From: Youssef Bashandy Date: Thu, 29 Feb 2024 12:14:06 +0200 Subject: [PATCH] [FIX] point_of_sale : printing expected shipping date on receipt Steps to reproduce: 1- Install Point of sale module 2- Allow shipping later configuration 3- Create a POS order with a shipping date Current behavior before PR: The expected shipping date was not printed in the pos receipt. This was happening because it was getting called wrong in xml file where it was called 'props.shippingDate'. By checking the JS file we found that the props object structure as follows https://github.com/odoo/odoo/blob/17.0/addons/point_of_sale/static/src/app/screens/receipt_screen/receipt/order_receipt.js#L16:L19 Desired behavior after PR is merged: The expected shipping date is printed not if exists. As we it is now getting called correctly 'props.data.shippingDate' opw-3746053 closes odoo/odoo#155844 Signed-off-by: Joseph Caburnay (jcb) --- .../receipt_screen/receipt/order_receipt.xml | 4 ++-- .../static/tests/tours/PaymentScreen.tour.js | 18 ------------------ .../static/tests/tours/ReceiptScreen.tour.js | 7 +++++++ .../tours/helpers/PaymentScreenTourMethods.js | 10 ++++++++++ .../tours/helpers/ReceiptScreenTourMethods.js | 11 ++++++++++- addons/point_of_sale/tests/test_frontend.py | 1 + 6 files changed, 30 insertions(+), 21 deletions(-) diff --git a/addons/point_of_sale/static/src/app/screens/receipt_screen/receipt/order_receipt.xml b/addons/point_of_sale/static/src/app/screens/receipt_screen/receipt/order_receipt.xml index d16bcd85a09..2fdb7058f77 100644 --- a/addons/point_of_sale/static/src/app/screens/receipt_screen/receipt/order_receipt.xml +++ b/addons/point_of_sale/static/src/app/screens/receipt_screen/receipt/order_receipt.xml @@ -124,10 +124,10 @@
- +
Expected delivery: -
+
diff --git a/addons/point_of_sale/static/tests/tours/PaymentScreen.tour.js b/addons/point_of_sale/static/tests/tours/PaymentScreen.tour.js index 4f1f5bc3a2d..ac7052a67d6 100644 --- a/addons/point_of_sale/static/tests/tours/PaymentScreen.tour.js +++ b/addons/point_of_sale/static/tests/tours/PaymentScreen.tour.js @@ -275,21 +275,3 @@ registry.category("web_tour.tours").add("PaymentScreenTotalDueWithOverPayment", PaymentScreen.totalDueIs("1.95"), ].flat(), }); - -registry.category("web_tour.tours").add("InvoiceShipLaterAccessRight", { - test: true, - url: "/pos/ui", - steps: () => - [ - ProductScreen.confirmOpeningPopup(), - ProductScreen.clickHomeCategory(), - ProductScreen.addOrderline("Whiteboard Pen", "1"), - ProductScreen.clickPartnerButton(), - ProductScreen.clickCustomer("Deco Addict"), - ProductScreen.clickPayButton(), - - PaymentScreen.clickPaymentMethod("Cash"), - PaymentScreen.clickShipLaterButton(), - PaymentScreen.clickValidate(), - ].flat(), -}); diff --git a/addons/point_of_sale/static/tests/tours/ReceiptScreen.tour.js b/addons/point_of_sale/static/tests/tours/ReceiptScreen.tour.js index d2db1d25a41..89b70e2a888 100644 --- a/addons/point_of_sale/static/tests/tours/ReceiptScreen.tour.js +++ b/addons/point_of_sale/static/tests/tours/ReceiptScreen.tour.js @@ -18,11 +18,17 @@ registry.category("web_tour.tours").add("ReceiptScreenTour", { // press close button in receipt screen ProductScreen.addOrderline("Letter Tray", "10", "5"), ProductScreen.selectedOrderlineHas("Letter Tray", "10"), + ProductScreen.clickPartnerButton(), + ProductScreen.clickCustomer("Addison Olson"), ProductScreen.clickPayButton(), PaymentScreen.clickPaymentMethod("Bank"), PaymentScreen.validateButtonIsHighlighted(true), + PaymentScreen.clickShipLaterButton(), + PaymentScreen.shippingLaterHighlighted(), PaymentScreen.clickValidate(), ReceiptScreen.receiptIsThere(), + //receipt had expected delivery printed + ReceiptScreen.shippingDateExists(), // letter tray has 10% tax (search SRC) ReceiptScreen.totalAmountContains("55.0"), ReceiptScreen.clickNextOrder(), @@ -70,6 +76,7 @@ registry.category("web_tour.tours").add("ReceiptScreenTour", { PaymentScreen.clickPaymentMethod("Bank"), PaymentScreen.clickValidate(), Order.hasLine({ customerNote: "Test customer note" }), + ReceiptScreen.clickNextOrder(), ].flat(), }); diff --git a/addons/point_of_sale/static/tests/tours/helpers/PaymentScreenTourMethods.js b/addons/point_of_sale/static/tests/tours/helpers/PaymentScreenTourMethods.js index 3f5572a0326..408c8b63ded 100644 --- a/addons/point_of_sale/static/tests/tours/helpers/PaymentScreenTourMethods.js +++ b/addons/point_of_sale/static/tests/tours/helpers/PaymentScreenTourMethods.js @@ -277,3 +277,13 @@ export function clickShipLaterButton() { }, ] } + +export function shippingLaterHighlighted(){ + return [ + { + content: 'Shipping later button is highlighted', + trigger: '.button:contains("Ship Later").highlight', + isCheck: true + } + ] +} diff --git a/addons/point_of_sale/static/tests/tours/helpers/ReceiptScreenTourMethods.js b/addons/point_of_sale/static/tests/tours/helpers/ReceiptScreenTourMethods.js index b91266ff998..488db876ad8 100644 --- a/addons/point_of_sale/static/tests/tours/helpers/ReceiptScreenTourMethods.js +++ b/addons/point_of_sale/static/tests/tours/helpers/ReceiptScreenTourMethods.js @@ -98,4 +98,13 @@ export function trackingMethodIsLot() { run: () => {}, }, ]; -} \ No newline at end of file +} + +export function shippingDateExists() { + return [ + { + content: 'Shipping date must be printed', + trigger: '.pos-receipt-order-data:contains("Expected delivery:")' + } + ] +} diff --git a/addons/point_of_sale/tests/test_frontend.py b/addons/point_of_sale/tests/test_frontend.py index 8c76fdcf82f..260c616626f 100644 --- a/addons/point_of_sale/tests/test_frontend.py +++ b/addons/point_of_sale/tests/test_frontend.py @@ -527,6 +527,7 @@ class TestUi(TestPointOfSaleHttpCommon): self.main_pos_config.write({ 'iface_tipproduct': True, 'tip_product_id': self.tip.id, + 'ship_later': True }) # open a session, the /pos/ui controller will redirect to it