diff --git a/addons/point_of_sale/static/src/js/devices.js b/addons/point_of_sale/static/src/js/devices.js index 98f0dcf29d0..782aac8c101 100644 --- a/addons/point_of_sale/static/src/js/devices.js +++ b/addons/point_of_sale/static/src/js/devices.js @@ -79,10 +79,11 @@ function openerp_pos_devices(instance,module){ //module is instance.point_of_sal //the client is starting to weight weighting_start: function(){ if(!this.weighting){ - this.weight = 0; this.weighting = true; - this.bypass_proxy = false; - return this.message('weighting_start'); + if(!this.bypass_proxy){ + this.weight = 0; + return this.message('weighting_start'); + } } }, @@ -104,18 +105,25 @@ function openerp_pos_devices(instance,module){ //module is instance.point_of_sal } }, - // sets a custom weight, ignoring the proxy returned value until the next weighting_end + // sets a custom weight, ignoring the proxy returned value. debug_set_weight: function(kg){ this.bypass_proxy = true; this.weight = kg; }, + // resets the custom weight and re-enable listening to the proxy for weight values + debug_reset_weight: function(){ + this.bypass_proxy = false; + this.weight = 0; + }, + // the client has finished weighting products weighting_end: function(){ - this.weight = 0; - this.weighting = false; - this.bypass_proxy = false; - return this.message('weighting_end'); + if(!this.bypass_proxy){ + this.weight = 0; + this.weighting = false; + this.message('weighting_end'); + } }, // the pos asks the client to pay 'price' units diff --git a/addons/point_of_sale/static/src/js/screens.js b/addons/point_of_sale/static/src/js/screens.js index b783b170f9e..1abb024498a 100644 --- a/addons/point_of_sale/static/src/js/screens.js +++ b/addons/point_of_sale/static/src/js/screens.js @@ -467,6 +467,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa close: function(){ this._super(); clearInterval(this.intervalID); + this.pos.proxy.weighting_end(); }, }); diff --git a/addons/point_of_sale/static/src/js/widgets.js b/addons/point_of_sale/static/src/js/widgets.js index c983b87168e..0d7a6cacff2 100644 --- a/addons/point_of_sale/static/src/js/widgets.js +++ b/addons/point_of_sale/static/src/js/widgets.js @@ -712,6 +712,9 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa self.pos.proxy.debug_set_weight(kg); } }); + this.$('.button.reset_weight').click(function(){ + self.pos.proxy.debug_reset_weight(); + }); this.$('.button.custom_ean').click(function(){ var ean = self.pos.barcode_reader.sanitize_ean(self.$('input.ean').val() || '0'); self.$('input.ean').val(ean); diff --git a/addons/point_of_sale/static/src/xml/pos.xml b/addons/point_of_sale/static/src/xml/pos.xml index e43c0d39bbb..368188c56ad 100644 --- a/addons/point_of_sale/static/src/xml/pos.xml +++ b/addons/point_of_sale/static/src/xml/pos.xml @@ -445,6 +445,7 @@
Barcode Scanner