From 276b2a1f208a780ba26e7661ac3103d17a572d53 Mon Sep 17 00:00:00 2001 From: roen-odoo <roen@odoo.com> 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#106553 X-original-commit: a61c2b88de20c4423ab880d93a3b61e881913f60 Signed-off-by: Trinh Jacky (trj) <trj@odoo.com> --- .../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 adae7f58fe19..5680a15b73c3 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 15bd01e013f6..ed6c0a808956 100644 --- a/addons/pos_restaurant/tests/test_frontend.py +++ b/addons/pos_restaurant/tests/test_frontend.py @@ -191,3 +191,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_session_cb(check_coa=False) + self.start_tour("/pos/ui?config_id=%d" % self.pos_config.id, 'SplitBillScreenTour2', login="admin") -- GitLab