From 75211a4557f304a66cfd84442b034374f185756d Mon Sep 17 00:00:00 2001 From: roen-odoo Date: Mon, 30 May 2022 15:04:35 +0000 Subject: [PATCH] [FIX] point_of_sale: prevent crash with float quantity when edit lot Current behavior: In the PoS if you add a tracked product that uses "kg" as uom and change the quantity to any float value. After that if you try to modify the lot number you get an error. Steps to reproduce: - Have PoS installed - Create a tracked product that use kg as uom - Open PoS session - Add the product to the order and modify the quantity to any float value - Click on the green lines to edit the lot number - You get an error opw-2861426 [FIX] point_of_sale: float_serial Current behavior: Steps to reproduce: opw-2861426 closes odoo/odoo#92722 X-original-commit: 0aff8bb9484a23c0d875d3b12259dd4e0d51e716 Signed-off-by: Nicolas Lempereur (nle) Signed-off-by: Engels Robin (roen) --- addons/point_of_sale/static/src/js/models.js | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index 81fb4432426..7b32d759987 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -1217,6 +1217,7 @@ class Orderline extends PosModel { getPackLotLinesToEdit(isAllowOnlyOneLot) { const currentPackLotLines = this.pack_lot_lines; let nExtraLines = Math.abs(this.quantity) - currentPackLotLines.length; + nExtraLines = Math.ceil(nExtraLines); nExtraLines = nExtraLines > 0 ? nExtraLines : 1; const tempLines = currentPackLotLines .map(lotLine => ({