From d64a58007d0bed3e32fe12cf0280c0aa3beec268 Mon Sep 17 00:00:00 2001 From: Joseph Caburnay Date: Tue, 25 May 2021 09:17:57 +0000 Subject: [PATCH] [FIX] point_of_sale: compare the quantity to number type When identifying whether to show the decrease quantity popup or not, the current quantity of the selected orderline is compared to the new input quantity. This fix properly compares the current quantity to the new input quantity in number format. X-original-commit: 61bb684c4b610227a3a22e68512146dc2ee5974d --- .../static/src/js/Screens/ProductScreen/ProductScreen.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/point_of_sale/static/src/js/Screens/ProductScreen/ProductScreen.js b/addons/point_of_sale/static/src/js/Screens/ProductScreen/ProductScreen.js index ae9183a3cf8..52c721e04cd 100644 --- a/addons/point_of_sale/static/src/js/Screens/ProductScreen/ProductScreen.js +++ b/addons/point_of_sale/static/src/js/Screens/ProductScreen/ProductScreen.js @@ -9,6 +9,7 @@ odoo.define('point_of_sale.ProductScreen', function(require) { const { onChangeOrder, useBarcodeReader } = require('point_of_sale.custom_hooks'); const { Gui } = require('point_of_sale.Gui'); const { useState } = owl.hooks; + const { parse } = require('web.field_utils'); class ProductScreen extends ControlButtonsMixin(PosComponent) { constructor() { @@ -168,11 +169,12 @@ odoo.define('point_of_sale.ProductScreen', function(require) { }); return; } + const parsedInput = parse.float(event.detail.buffer) || 0 if(lastId != selectedLine.cid) this._showDecreaseQuantityPopup(); - else if(currentQuantity < event.detail.buffer) + else if(currentQuantity < parsedInput) this._setValue(event.detail.buffer); - else if(event.detail.buffer < currentQuantity) + else if(parsedInput < currentQuantity) this._showDecreaseQuantityPopup(); } else { let { buffer } = event.detail;