From b8fd0fef0810665ee1e2e8a767588e63be022d7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20van=20der=20Essen?= Date: Tue, 2 Jul 2013 22:40:48 +0200 Subject: [PATCH 1/5] [FIX] point_of_sale: new order was broken when multiple orders already present bzr revid: fva@openerp.com-20130702204048-018r4xr34mw7y2m5 --- addons/point_of_sale/static/src/js/models.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index 98ba49c8856..78d77cc080c 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -234,8 +234,7 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal on_removed_order: function(removed_order){ if( this.get('orders').isEmpty()){ this.add_new_order(); - } - if( this.get('selectedOrder') === removed_order){ + }else{ this.set({ selectedOrder: this.get('orders').last() }); } }, From 06675241d0f45a10e6f898d70178f26da7651948 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20van=20der=20Essen?= Date: Mon, 8 Jul 2013 14:49:12 +0200 Subject: [PATCH 2/5] [FIX] point_of_sale: weighting end signal could fail to emit in debug mode bzr revid: fva@openerp.com-20130708124912-0t8l8v13ug3hst7m --- addons/point_of_sale/static/src/js/devices.js | 4 ++-- addons/point_of_sale/static/src/js/screens.js | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/point_of_sale/static/src/js/devices.js b/addons/point_of_sale/static/src/js/devices.js index e7d0376938c..fe16b2d4bbf 100644 --- a/addons/point_of_sale/static/src/js/devices.js +++ b/addons/point_of_sale/static/src/js/devices.js @@ -118,8 +118,8 @@ function openerp_pos_devices(instance,module){ //module is instance.point_of_sal }, // the client has finished weighting products - weighting_end: function(){ - if(!this.bypass_proxy){ + weighting_end: function(force){ + if(!this.bypass_proxy || force){ this.weight = 0; this.weighting = false; this.message('weighting_end'); diff --git a/addons/point_of_sale/static/src/js/screens.js b/addons/point_of_sale/static/src/js/screens.js index 7a01732c353..287330422cc 100644 --- a/addons/point_of_sale/static/src/js/screens.js +++ b/addons/point_of_sale/static/src/js/screens.js @@ -527,6 +527,8 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa }, order_product: function(){ var weight = this.pos.proxy.weighting_read_kg(); + console.log('weighting_end'); + this.pos.proxy.weighting_end('true'); this.pos.get('selectedOrder').addProduct(this.get_product(),{ quantity:weight }); }, get_product_name: function(){ From 004163733b9207158129c5349b4ee9805a03c7be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20van=20der=20Essen?= Date: Mon, 8 Jul 2013 14:56:44 +0200 Subject: [PATCH 3/5] [IMP] point_of_sale: removing console.logs bzr revid: fva@openerp.com-20130708125644-rdno41mmtwrao3z2 --- addons/point_of_sale/static/src/js/models.js | 1 - addons/point_of_sale/static/src/js/screens.js | 1 - 2 files changed, 2 deletions(-) diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index 78d77cc080c..2538f36eb13 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -104,7 +104,6 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal return self.fetch('res.currency',['symbol','position','rounding','accuracy'],[['id','=',self.get('company').currency_id[0]]]); }).then(function(currencies){ - console.log('Currency:',currencies[0]); self.set('currency',currencies[0]); return self.fetch('product.uom', null, null); diff --git a/addons/point_of_sale/static/src/js/screens.js b/addons/point_of_sale/static/src/js/screens.js index 287330422cc..76db49dc4ec 100644 --- a/addons/point_of_sale/static/src/js/screens.js +++ b/addons/point_of_sale/static/src/js/screens.js @@ -527,7 +527,6 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa }, order_product: function(){ var weight = this.pos.proxy.weighting_read_kg(); - console.log('weighting_end'); this.pos.proxy.weighting_end('true'); this.pos.get('selectedOrder').addProduct(this.get_product(),{ quantity:weight }); }, From 4f51882863a12539265134a97dc5d2a2913a013b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20van=20der=20Essen?= Date: Mon, 8 Jul 2013 16:55:22 +0200 Subject: [PATCH 4/5] [IMP] point_of_sale: reworked the way the weighting debug mode works to make it more robust bzr revid: fva@openerp.com-20130708145522-6r5yedizrg9h6m0r --- addons/point_of_sale/static/src/js/devices.js | 38 +++++++++---------- addons/point_of_sale/static/src/js/screens.js | 2 - addons/point_of_sale/static/src/js/widgets.js | 1 + 3 files changed, 20 insertions(+), 21 deletions(-) diff --git a/addons/point_of_sale/static/src/js/devices.js b/addons/point_of_sale/static/src/js/devices.js index fe16b2d4bbf..835b7fe7b5a 100644 --- a/addons/point_of_sale/static/src/js/devices.js +++ b/addons/point_of_sale/static/src/js/devices.js @@ -12,6 +12,8 @@ function openerp_pos_devices(instance,module){ //module is instance.point_of_sal this.weight = 0; this.weighting = false; + this.debug_weight = 0; + this.use_debug_weight = false; this.paying = false; this.default_payment_status = { @@ -92,38 +94,36 @@ function openerp_pos_devices(instance,module){ //module is instance.point_of_sal // and a weighting_end() weighting_read_kg: function(){ var self = this; - if(this.bypass_proxy){ - return this.weight; - }else{ - this.message('weighting_read_kg',{}) - .done(function(weight){ - if(self.weighting && !self.bypass_proxy){ + this.message('weighting_read_kg',{}) + .done(function(weight){ + if(self.weighting){ + if(self.use_debug_weight){ + self.weight = self.debug_weight; + }else{ self.weight = weight; } - }); - return this.weight; - } + } + }); + return this.weight; }, // sets a custom weight, ignoring the proxy returned value. debug_set_weight: function(kg){ - this.bypass_proxy = true; - this.weight = kg; + this.use_debug_weight = true; + this.debug_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; + this.use_debug_weight = false; + this.debug_weight = 0; }, // the client has finished weighting products - weighting_end: function(force){ - if(!this.bypass_proxy || force){ - this.weight = 0; - this.weighting = false; - this.message('weighting_end'); - } + weighting_end: function(){ + 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 0747fcd3d35..20253ffd27b 100644 --- a/addons/point_of_sale/static/src/js/screens.js +++ b/addons/point_of_sale/static/src/js/screens.js @@ -459,7 +459,6 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa icon: '/point_of_sale/static/src/img/icons/png48/go-previous.png', click: function(){ clearInterval(this.intervalID); - self.pos.proxy.weighting_end(); self.pos_widget.screen_selector.set_current_screen(self.previous_screen); } }); @@ -527,7 +526,6 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa }, order_product: function(){ var weight = this.pos.proxy.weighting_read_kg(); - this.pos.proxy.weighting_end('true'); this.pos.get('selectedOrder').addProduct(this.get_product(),{ quantity:weight }); }, get_product_name: function(){ diff --git a/addons/point_of_sale/static/src/js/widgets.js b/addons/point_of_sale/static/src/js/widgets.js index 96ccd85134d..24660ab6377 100644 --- a/addons/point_of_sale/static/src/js/widgets.js +++ b/addons/point_of_sale/static/src/js/widgets.js @@ -743,6 +743,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa } }); this.$('.button.reset_weight').click(function(){ + self.$('input.weight').val(''); self.pos.proxy.debug_reset_weight(); }); this.$('.button.custom_ean').click(function(){ From e5e2945ca0088ca677a342b0c2e07e0d72dccec3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20van=20der=20Essen?= Date: Mon, 8 Jul 2013 16:58:32 +0200 Subject: [PATCH 5/5] [FIX] point_of_sale: fixing bad translation in demo data bzr revid: fva@openerp.com-20130708145832-54dbakqun110kllo --- addons/point_of_sale/point_of_sale_demo.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/point_of_sale/point_of_sale_demo.xml b/addons/point_of_sale/point_of_sale_demo.xml index 011c6d81bfc..390d4750e14 100644 --- a/addons/point_of_sale/point_of_sale_demo.xml +++ b/addons/point_of_sale/point_of_sale_demo.xml @@ -290,7 +290,7 @@ True 5.10 - Fishing + Peaches True 2300001000008