Skip to content

Commit d024889

Browse files
committed
[FIX] point_of_sale: fix numpad behavior on payment screen
Steps to reproduce: =================== - Add a product to the orderline from the product screen - Click payment - Select any payment method - Enter the amount manually - Press `+20`, then press `2`, OR press `+20`, then press `6` Issue: ====== - In the case of `+20` and `2`, the expected result is `202`, but we get `20` - In the case of `+20` and `6`, the expected result is `206`, but we get `20.01` Cause: ====== - `formatCurrency` is used for the buffer, but the buffer should not depend on the currency Fix: ==== - Remove the usage of `formatCurrency` and treat the buffer as a string closes odoo#213294 Task: 4850543 Signed-off-by: David Monnom (moda) <[email protected]>
1 parent e828faa commit d024889

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

addons/point_of_sale/static/src/app/utils/number_buffer_service.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -289,11 +289,7 @@ class NumberBuffer extends EventBus {
289289
// when input is like '+10', '+50', etc
290290
const inputValue = oParseFloat(input.slice(1));
291291
const currentBufferValue = this.state.buffer ? oParseFloat(this.state.buffer) : 0;
292-
// FIXME POSREF: the `buffer` shouldn't be dependent on the currency.
293-
this.state.buffer = this.component.env.utils.formatCurrency(
294-
inputValue + currentBufferValue,
295-
false
296-
);
292+
this.state.buffer = (inputValue + currentBufferValue).toString()
297293
} else if (!isNaN(parseInt(input, 10))) {
298294
if (this.state.toStartOver) {
299295
// when we want to erase the current buffer for a new value

addons/point_of_sale/static/tests/tours/PaymentScreen.tour.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,17 @@ registry.category("web_tour.tours").add("PaymentScreenTour", {
4646
PaymentScreen.remainingIs("42.8"),
4747
PaymentScreen.changeIs("0.0"),
4848
PaymentScreen.validateButtonIsHighlighted(false),
49+
PaymentScreen.pressNumpad("5"),
50+
PaymentScreen.fillPaymentLineAmountMobile("Cash", "105"),
51+
PaymentScreen.remainingIs("0.00"),
52+
PaymentScreen.changeIs("52.2"),
53+
PaymentScreen.validateButtonIsHighlighted(true),
4954
PaymentScreen.pressNumpad("+50"),
50-
PaymentScreen.fillPaymentLineAmountMobile("Cash", "60"),
55+
PaymentScreen.fillPaymentLineAmountMobile("Cash", "155"),
5156
PaymentScreen.remainingIs("0.0"),
52-
PaymentScreen.changeIs("7.2"),
57+
PaymentScreen.changeIs("102.2"),
5358
PaymentScreen.validateButtonIsHighlighted(true),
54-
PaymentScreen.clickPaymentlineDelButton("Cash", "60.0"),
59+
PaymentScreen.clickPaymentlineDelButton("Cash", "155.0"),
5560

5661
// Multiple paymentlines
5762
PaymentScreen.clickPaymentMethod("Cash"),

0 commit comments

Comments
 (0)