From 9f5839c35a378a69ca47ec234c6cced247bbe8ac Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Tue, 13 Dec 2016 11:20:59 +0100 Subject: [PATCH] [FIX] point_of_sale: do not reset selected category every time There seems to be no need to reset to the root category on the product list every time we switch back to the list from another screen. Unless a full refresh was requested (e.g after closing an order). This avoids losing the currently selected category after each screen switch. It can be quite convenient to stay in the same category while the cashier is processing items that need to be weighed, for example. This commit allows POS screen widgets to distinguish when the user is expecting a full reset of the target screen, vs. simply re-displaying it. --- addons/point_of_sale/static/src/js/gui.js | 2 +- addons/point_of_sale/static/src/js/screens.js | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/addons/point_of_sale/static/src/js/gui.js b/addons/point_of_sale/static/src/js/gui.js index 11da0b4441f..360414c9b06 100644 --- a/addons/point_of_sale/static/src/js/gui.js +++ b/addons/point_of_sale/static/src/js/gui.js @@ -114,7 +114,7 @@ var Gui = core.Class.extend({ this.current_screen.hide(); } this.current_screen = screen; - this.current_screen.show(); + this.current_screen.show(refresh); } }, diff --git a/addons/point_of_sale/static/src/js/screens.js b/addons/point_of_sale/static/src/js/screens.js index ebdf2ec5762..a559ea7e7cc 100644 --- a/addons/point_of_sale/static/src/js/screens.js +++ b/addons/point_of_sale/static/src/js/screens.js @@ -938,10 +938,12 @@ var ProductScreenWidget = ScreenWidget.extend({ } }, - show: function(){ + show: function(reset){ this._super(); - this.product_categories_widget.reset_category(); - this.numpad.state.reset(); + if (reset) { + this.product_categories_widget.reset_category(); + this.numpad.state.reset(); + } }, close: function(){