From 727f7c417555b90f65b58a07accadc451b53776e Mon Sep 17 00:00:00 2001 From: Mahendra barad Date: Thu, 17 Sep 2015 12:59:40 +0530 Subject: [PATCH] [FIX] point_of_sale : Prevent a traceback when adding a global discount on an empty pos, allow use of a numeric pad dot (.) in payment screen. --- addons/point_of_sale/static/src/js/screens.js | 3 ++- addons/pos_discount/static/src/js/discount.js | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/point_of_sale/static/src/js/screens.js b/addons/point_of_sale/static/src/js/screens.js index 17eb7c29546..b6d873ec4ba 100644 --- a/addons/point_of_sale/static/src/js/screens.js +++ b/addons/point_of_sale/static/src/js/screens.js @@ -1510,7 +1510,8 @@ var PaymentScreenWidget = ScreenWidget.extend({ self.validate_order(); } else if ( event.keyCode === 190 || // Dot event.keyCode === 110 || // Decimal point (numpad) - event.keyCode === 188 ) { // Comma + event.keyCode === 188 || // Comma + event.keyCode === 46 ) { // Numpad dot key = '.'; } else if (event.keyCode >= 48 && event.keyCode <= 57) { // Numbers key = '' + (event.keyCode - 48); diff --git a/addons/pos_discount/static/src/js/discount.js b/addons/pos_discount/static/src/js/discount.js index d47fbd751a4..497573f5107 100644 --- a/addons/pos_discount/static/src/js/discount.js +++ b/addons/pos_discount/static/src/js/discount.js @@ -23,13 +23,13 @@ var DiscountButton = screens.ActionButtonWidget.extend({ // Remove existing discounts var i = 0; - do { + while ( i < lines.length ) { if (lines[i].get_product() === product) { order.remove_orderline(lines[i]); } else { i++; } - } while ( i < lines.length ); + } // Add discount var discount = - pc / 100.0 * order.get_total_with_tax();