[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) <trj@odoo.com>
This commit is contained in:
roen-odoo
2022-11-30 11:08:56 +01:00
parent f613ce968d
commit 5786d8adee
2 changed files with 30 additions and 0 deletions
@@ -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());
});
@@ -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")