From 5786d8adee0961eb06897b4f63185208db1bd3fb Mon Sep 17 00:00:00 2001 From: roen-odoo Date: Wed, 23 Nov 2022 15:43:54 +0000 Subject: [PATCH] [FIX] pos_restaurant: correctly save splitted order Current behavior: When splitting the order in a pos_restaurant session, the order was not correctly saved in the backend. It resulted in an order that still had all the product of the original order and another order with the correctly splitted products. Steps to reproduce: - Start a pos_restaurant session. - Go to table A and add 3 products to the table. - Go back to the floor screen - Go back to the table A - Split the order in 2 - Click on payment, and go back to the product screen without paying - Click on the ticket button, and click on the order that was splitted, it still contains all the products from the original order. opw-3061569 closes odoo/odoo#106813 X-original-commit: bf8acd51ffb96048a7123d1abd2f6865d27a41f9 Signed-off-by: Trinh Jacky (trj) --- .../tests/tours/SplitBillScreen.tour.js | 26 +++++++++++++++++++ addons/pos_restaurant/tests/test_frontend.py | 4 +++ 2 files changed, 30 insertions(+) diff --git a/addons/pos_restaurant/static/tests/tours/SplitBillScreen.tour.js b/addons/pos_restaurant/static/tests/tours/SplitBillScreen.tour.js index adae7f58fe1..5680a15b73c 100644 --- a/addons/pos_restaurant/static/tests/tours/SplitBillScreen.tour.js +++ b/addons/pos_restaurant/static/tests/tours/SplitBillScreen.tour.js @@ -51,4 +51,30 @@ odoo.define('pos_restaurant.tour.SplitBillScreen', function (require) { ProductScreen.do.clickOrderline('Minute Maid', '3.0') Tour.register('SplitBillScreenTour', { test: true, url: '/pos/ui' }, getSteps()); + + startSteps(); + + FloorScreen.do.clickTable('T2'); + ProductScreen.exec.addOrderline('Water', '1', '2.0'); + ProductScreen.exec.addOrderline('Minute Maid', '1', '2.0'); + ProductScreen.exec.addOrderline('Coca-Cola', '1', '2.0'); + Chrome.do.backToFloor(); + FloorScreen.do.clickTable('T2'); + ProductScreen.do.clickSplitBillButton(); + + SplitBillScreen.do.clickOrderline('Water'); + SplitBillScreen.do.clickOrderline('Coca-Cola'); + SplitBillScreen.do.clickPay(); + PaymentScreen.do.clickBack(); + Chrome.do.clickTicketButton(); + TicketScreen.do.selectOrder('-0002'); + ProductScreen.do.clickOrderline('Water', '1.0'); + ProductScreen.do.clickOrderline('Coca-Cola', '1.0'); + ProductScreen.check.totalAmountIs('4.40'); + Chrome.do.clickTicketButton(); + TicketScreen.do.selectOrder('-0001'); + ProductScreen.do.clickOrderline('Minute Maid', '1.0'); + ProductScreen.check.totalAmountIs('2.20'); + + Tour.register('SplitBillScreenTour2', { test: true, url: '/pos/ui' }, getSteps()); }); diff --git a/addons/pos_restaurant/tests/test_frontend.py b/addons/pos_restaurant/tests/test_frontend.py index 819a326f36c..69ad27877ad 100644 --- a/addons/pos_restaurant/tests/test_frontend.py +++ b/addons/pos_restaurant/tests/test_frontend.py @@ -190,3 +190,7 @@ class TestFrontend(odoo.tests.HttpCase): self.assertTrue(order2.is_tipped and order2.tip_amount == 1.00) self.assertTrue(order3.is_tipped and order3.tip_amount == 1.50) self.assertTrue(order4.is_tipped and order4.tip_amount == 1.00) + + def test_06_split_bill_screen(self): + self.pos_config.with_user(self.env.ref('base.user_admin')).open_ui() + self.start_tour("/pos/ui?config_id=%d" % self.pos_config.id, 'SplitBillScreenTour2', login="admin")