[FIX] point_of_sale: 0 => +/- => backspace => 0 and not -

When writting number on the point of sale keypad, if you click on the
"+/-" button, you will get 0 (with buffer "-0"), but then you need to
backspace 2 times to remove "-".

This seems odd since this mean that:

=> "+/-" "backspace" "backspace" "5" will get 5.0 units
=> "+/-" "backspace" "backspace" "backspace" will remove line

instead of what would be expected:

=> "+/-" "backspace" "5" will get 5.0 units
=> "+/-" "backspace" "backspace" will remove the line

opw-2169157
closes #43495

closes odoo/odoo#43507

X-original-commit: d3489146e9e1e20903bf8775527cb8b32a2ba383
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
This commit is contained in:
Nicolas Lempereur
2020-01-17 16:15:33 +00:00
parent 5198b209f5
commit 74be8c0f76
@@ -3115,6 +3115,9 @@ exports.NumpadState = Backbone.Model.extend({
}else{
this.trigger('set_value',this.get('buffer'));
}
} else if (this.get('buffer') === "-0") {
this.set({ buffer: "0" });
this.trigger('set_value',this.get('buffer'));
}else{
var newBuffer = this.get('buffer').slice(0,-1) || "";
this.set({ buffer: newBuffer });