diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index fc239199a80..bea0c4c0f5f 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -3711,7 +3711,7 @@ export class Order extends PosModel { (this.get_total_with_tax() < 0 && remaining > 0) || (this.get_total_with_tax() > 0 && remaining < 0) ) { - rounding_method = rounding_method.endsWith("UP") ? "DOWN" : rounding_method; + rounding_method = rounding_method.endsWith("UP") ? "DOWN" : "UP"; } remaining *= sign; 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 03585fc5e1a..5d44bcd09d6 100644 --- a/addons/point_of_sale/static/tests/tours/PaymentScreen.tour.js +++ b/addons/point_of_sale/static/tests/tours/PaymentScreen.tour.js @@ -172,3 +172,19 @@ PaymentScreen.check.remainingIs('0.0'); PaymentScreen.check.changeIs('0.0'); registry.category("web_tour.tours").add('PaymentScreenRoundingHalfUp', { test: true, url: '/pos/ui', steps: getSteps() }); + +startSteps(); + +ProductScreen.do.clickHomeCategory(); +ProductScreen.exec.addOrderline('Product Test', '1'); +ProductScreen.do.clickPayButton(); + +PaymentScreen.check.totalIs('1.95'); +PaymentScreen.exec.pay('Cash', '5'); + +PaymentScreen.check.remainingIs('0.0'); +PaymentScreen.check.changeIs('3.05'); +PaymentScreen.check.totalDueIs('1.95'); +Chrome.do.clickTicketButton(); + +registry.category("web_tour.tours").add('PaymentScreenTotalDueWithOverPayment', { test: true, url: '/pos/ui', steps: getSteps() }); 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 81934b97d76..cdc9a635068 100644 --- a/addons/point_of_sale/static/tests/tours/helpers/PaymentScreenTourMethods.js +++ b/addons/point_of_sale/static/tests/tours/helpers/PaymentScreenTourMethods.js @@ -194,6 +194,15 @@ class Check { }, ]; } + totalDueIs(amount) { + return [ + { + content: `total due is ${amount}`, + trigger: `.payment-status-total-due:contains("${amount}")`, + run: () => {}, + }, + ]; + } } class Execute { diff --git a/addons/point_of_sale/tests/test_frontend.py b/addons/point_of_sale/tests/test_frontend.py index b8fb220c469..d7e40ca0b27 100644 --- a/addons/point_of_sale/tests/test_frontend.py +++ b/addons/point_of_sale/tests/test_frontend.py @@ -633,6 +633,7 @@ class TestUi(TestPointOfSaleHttpCommon): self.main_pos_config.open_ui() self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'PaymentScreenRoundingDown', login="accountman") + self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'PaymentScreenTotalDueWithOverPayment', login="accountman") def test_rounding_half_up(self): rouding_method = self.env['account.cash.rounding'].create({