[FIX] point_of_sale: barcode and ENTER key

- Set a barcode for a product A
- Open the POS interface
- Click on a product B => it is added to the order
- Scan product A

Product A is added to the order, but a unit of B is also added.

Commit 9de1bc0eef introduced keyboard shortcuts in the POS
interface. In particular, when a product is selected, pressing the SPACE
or the ENTER key adds it in the order. Since the barcode scanner sends
an ENTER key as a final character, it triggers the addition of both
products.

opw-1934520

closes odoo/odoo#31185
This commit is contained in:
Nicolas Martinelli
2019-02-18 10:00:20 +00:00
parent ad3207c1ff
commit b04d78000f
@@ -842,8 +842,8 @@ var ProductListWidget = PosBaseWidget.extend({
};
this.keypress_product_handler = function(ev){
if (ev.which != 13 && ev.which != 32) {
// Key is not space or enter
// React only to SPACE to avoid interfering with warcode scanner which sends ENTER
if (ev.which != 32) {
return;
}
ev.preventDefault();