From c850875ca386d81c69f02aa6614bb290b4264cf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20van=20der=20Essen?= Date: Tue, 2 Oct 2012 12:04:20 +0200 Subject: [PATCH 1/8] [FIX] point_of_sale: Number.isNaN is not supported on older but supported browsers bzr revid: fva@openerp.com-20121002100420-pcvbn7qqxyp62bzw --- addons/point_of_sale/static/src/js/widgets.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/point_of_sale/static/src/js/widgets.js b/addons/point_of_sale/static/src/js/widgets.js index 47a527a010d..72e7c5c1612 100644 --- a/addons/point_of_sale/static/src/js/widgets.js +++ b/addons/point_of_sale/static/src/js/widgets.js @@ -712,7 +712,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa }); this.$('.button.set_weight').click(function(){ var kg = Number(self.$('input.weight').val()); - if(!Number.isNaN(kg)){ + if(!isNaN(kg)){ self.pos.proxy.debug_set_weight(kg); } }); From 0fa7da31685d353e1d397f0f078629447ec9660e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20van=20der=20Essen?= Date: Tue, 2 Oct 2012 12:13:53 +0200 Subject: [PATCH 2/8] [WIP FIX] point_of_sale: investigating a bug with codebar scanning in subcategories bzr revid: fva@openerp.com-20121002101353-imjbqe1vxtdjbqu7 --- addons/point_of_sale/static/src/js/devices.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/point_of_sale/static/src/js/devices.js b/addons/point_of_sale/static/src/js/devices.js index 142d35bd340..f998ed334df 100644 --- a/addons/point_of_sale/static/src/js/devices.js +++ b/addons/point_of_sale/static/src/js/devices.js @@ -432,13 +432,13 @@ function openerp_pos_devices(instance,module){ //module is instance.point_of_sal // The barcode readers acts as a keyboard, we catch all keyup events and try to find a // barcode sequence in the typed keys, then act accordingly. $('body').delegate('','keyup', function (e){ - + console.log('keyup:'+String.fromCharCode(e.keyCode)+' '+e.keyCode,e); //We only care about numbers - if (!isNaN(Number(String.fromCharCode(e.keyCode)))) { + if (e.keyCode >= 48 && e.keyCode < 58){ // The barcode reader sends keystrokes with a specific interval. // We look if the typed keys fit in the interval. - if (codeNumbers.length==0) { + if (codeNumbers.length === 0) { timeStamp = new Date().getTime(); } else { if (lastTimeStamp + 30 < new Date().getTime()) { @@ -449,7 +449,7 @@ function openerp_pos_devices(instance,module){ //module is instance.point_of_sal } codeNumbers.push(e.keyCode - 48); lastTimeStamp = new Date().getTime(); - if (codeNumbers.length == 13) { + if (codeNumbers.length === 13) { //We have found what seems to be a valid codebar self.on_ean(codeNumbers.join('')); codeNumbers = []; From 58ec91eb79b873db6f38ff2c770c1b63f1cb887a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20van=20der=20Essen?= Date: Wed, 14 Nov 2012 16:55:40 +0100 Subject: [PATCH 3/8] [FIX] point_of_sale: bad indentation bzr revid: fva@openerp.com-20121114155540-dvkat6on42koims3 --- addons/point_of_sale/static/src/js/widgets.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/point_of_sale/static/src/js/widgets.js b/addons/point_of_sale/static/src/js/widgets.js index 5669bfe101b..bc5f29601a8 100644 --- a/addons/point_of_sale/static/src/js/widgets.js +++ b/addons/point_of_sale/static/src/js/widgets.js @@ -202,9 +202,9 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa this.currentOrderLines.bind('remove', this.renderElement, this); }, update_numpad: function() { - this.selected_line = this.pos.get('selectedOrder').getSelectedLine(); - if (this.numpadState) - this.numpadState.reset(); + this.selected_line = this.pos.get('selectedOrder').getSelectedLine(); + if (this.numpadState) + this.numpadState.reset(); }, renderElement: function() { var self = this; From 107e579ecdfb0ab8d20fb2e532a17967fc51350b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20van=20der=20Essen?= Date: Wed, 14 Nov 2012 17:50:43 +0100 Subject: [PATCH 4/8] [IMP] point_of_sale: auto focus on paymentlines bzr revid: fva@openerp.com-20121114165043-vbfj1r93ww3es9qt --- addons/point_of_sale/static/src/js/screens.js | 3 ++- addons/point_of_sale/static/src/js/widgets.js | 3 +-- 2 files changed, 3 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 0b8ab70a9c0..d8e53066c1e 100644 --- a/addons/point_of_sale/static/src/js/screens.js +++ b/addons/point_of_sale/static/src/js/screens.js @@ -899,7 +899,6 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa }); this.updatePaymentSummary(); - this.$('.paymentline-amout input').last().focus(); }, close: function(){ this._super(); @@ -946,6 +945,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa self.deleteLine(r); }); x.appendTo(this.$('#paymentlines')); + this.$('.paymentline-amount input:last').focus(); }, renderElement: function() { this._super(); @@ -975,6 +975,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa if(this.pos_widget.action_bar){ this.pos_widget.action_bar.set_button_disabled('validation', remaining > 0); } + this.$('.paymentline-amount input:last').focus(); }, set_numpad_state: function(numpadState) { if (this.numpadState) { diff --git a/addons/point_of_sale/static/src/js/widgets.js b/addons/point_of_sale/static/src/js/widgets.js index bc5f29601a8..94d6a5dc57e 100644 --- a/addons/point_of_sale/static/src/js/widgets.js +++ b/addons/point_of_sale/static/src/js/widgets.js @@ -298,8 +298,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa this.payment_line.bind('change', this.changedAmount, this); }, changeAmount: function(event) { - var newAmount; - newAmount = event.currentTarget.value; + var newAmount = event.currentTarget.value; if (newAmount && !isNaN(newAmount)) { this.amount = parseFloat(newAmount); this.payment_line.set_amount(this.amount); From 8c820330a5e4985b622fcfaf10af45d1c6ef2379 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20van=20der=20Essen?= Date: Wed, 14 Nov 2012 18:00:06 +0100 Subject: [PATCH 5/8] [FIX] point_of_sale: removed the gif loader, replaced it by niv's js one bzr revid: fva@openerp.com-20121114170006-gkx6ezikiw86po7u --- addons/point_of_sale/static/src/css/pos.css | 5 ----- addons/point_of_sale/static/src/img/loader.gif | Bin 3208 -> 0 bytes addons/point_of_sale/static/src/js/widgets.js | 8 +++++--- addons/point_of_sale/static/src/xml/pos.xml | 1 - 4 files changed, 5 insertions(+), 9 deletions(-) delete mode 100644 addons/point_of_sale/static/src/img/loader.gif diff --git a/addons/point_of_sale/static/src/css/pos.css b/addons/point_of_sale/static/src/css/pos.css index 675b77345e7..9b286be250e 100644 --- a/addons/point_of_sale/static/src/css/pos.css +++ b/addons/point_of_sale/static/src/css/pos.css @@ -62,11 +62,6 @@ z-index: 999; text-align: center; } -.point-of-sale .loader img{ - position:absolute; - top:50%; - left:50%; -} /* ********* Generic element styling ********* */ diff --git a/addons/point_of_sale/static/src/img/loader.gif b/addons/point_of_sale/static/src/img/loader.gif deleted file mode 100644 index 967288f55af9a3c9f27985da9559516e2d343aba..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3208 zcmc(iX;2es0*0IPk)vBzyMq%5tO1D#<3Lc!aHKtKWl5=E346};sT2m;{<36V2| z%Yc$VVu+52cz})$f()nwh2!n4F5rv@-eWoIxKrzbJ5EvicdKUmXIEEuJPZ&mX{ zf;>DESpW-o0{|=*>%)f+LZMKlQY9oLWMpIv4-X$de%#N`kIUtXM4|@|9=w159{6)5NZD*pyC3(lDoq*l15I~!J)b0biA~1R-&rcY*$b|!1 zOx{{J^@gdB0??ybgCWU@hKZp^Vu9SDDG0M{i6Z%FqK_{m8y2k`cjmaex?b9@-(@GQ zzVIE#iZsjHp`XLEXmlZkINSXe%v<2MeD+QYsL*b)XSDm7_^TdHrWuOn^%q{8I4+@+ zGcx(UB8aw`4i#nui;HddAb!4T4mCEuF<$9SCBa~;q4A)%!K@87sq}}BG=wAQ7^_paaHBO)79iys0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hxz6Ws$39qP z9lmpJ7k=g}EZZ?WAf6l73wq(XYd?>59@=jC6J#Y=HyUv@MF70+T(R5*n9yF8{0ig_ f?;bJ!IG4z`!2|SU|C{?ziu+^(yr=#HK3@L@=n}49 diff --git a/addons/point_of_sale/static/src/js/widgets.js b/addons/point_of_sale/static/src/js/widgets.js index 94d6a5dc57e..4ab6ee4f5ee 100644 --- a/addons/point_of_sale/static/src/js/widgets.js +++ b/addons/point_of_sale/static/src/js/widgets.js @@ -791,7 +791,9 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa template: 'PosWidget', init: function() { this._super(arguments[0],{}); - + + instance.web.blockUI(); + this.pos = new module.PosModel(this.session); this.pos_widget = this; //So that pos_widget's childs have pos_widget set automatically @@ -841,11 +843,11 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa self.screen_selector.show_popup('error', 'Sorry, we could not find any PoS Configuration for this session'); } + instance.web.unblockUI(); self.$('.loader').animate({opacity:0},1500,'swing',function(){self.$('.loader').hide();}); - self.$('.loader img').hide(); }).fail(function(){ // error when loading models data from the backend - self.$('.loader img').hide(); + instance.web.unblockUI(); return new instance.web.Model("ir.model.data").get_func("search_read")([['name', '=', 'action_pos_session_opening']], ['res_id']) .pipe( _.bind(function(res){ return instance.session.rpc('/web/action/load', {'action_id': res[0]['res_id']}) diff --git a/addons/point_of_sale/static/src/xml/pos.xml b/addons/point_of_sale/static/src/xml/pos.xml index 986921af1c5..cb4d90f1671 100644 --- a/addons/point_of_sale/static/src/xml/pos.xml +++ b/addons/point_of_sale/static/src/xml/pos.xml @@ -31,7 +31,6 @@
-
From 1af48858a5d7870e096c95246730fe7fe298b98a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20van=20der=20Essen?= Date: Mon, 19 Nov 2012 17:09:00 +0100 Subject: [PATCH 6/8] [IMP] prompt for cashier intervention when negative or zero price in self-checkout bzr revid: fva@openerp.com-20121119160900-ks6a0bfuswlipyvu --- addons/point_of_sale/static/src/js/screens.js | 12 ++++++++++-- addons/point_of_sale/static/src/js/widgets.js | 4 ++++ addons/point_of_sale/static/src/xml/pos.xml | 8 ++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/addons/point_of_sale/static/src/js/screens.js b/addons/point_of_sale/static/src/js/screens.js index d8e53066c1e..61c6d1cc2b8 100644 --- a/addons/point_of_sale/static/src/js/screens.js +++ b/addons/point_of_sale/static/src/js/screens.js @@ -430,6 +430,10 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa template:'ErrorSessionPopupWidget', }); + module.ErrorNegativePricePopupWidget = module.ErrorPopupWidget.extend({ + template:'ErrorNegativePricePopupWidget', + }); + module.ScaleInviteScreenWidget = module.ScreenWidget.extend({ template:'ScaleInviteScreenWidget', @@ -684,8 +688,12 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa console.log("CANCEL_END"); return (new $.Deferred()).resolve(); } - - this.queue.schedule(this.start); + + if(this.pos.get('selectedOrder').getDueLeft() <= 0){ + this.pos_widget.screen_selector.show_popup('error-negative-price'); + }else{ + this.queue.schedule(this.start); + } this.add_action_button({ label: 'back', diff --git a/addons/point_of_sale/static/src/js/widgets.js b/addons/point_of_sale/static/src/js/widgets.js index 4984ee5dda9..6038a74b35e 100644 --- a/addons/point_of_sale/static/src/js/widgets.js +++ b/addons/point_of_sale/static/src/js/widgets.js @@ -904,6 +904,9 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa this.choose_receipt_popup = new module.ChooseReceiptPopupWidget(this, {}); this.choose_receipt_popup.appendTo($('.point-of-sale')); + this.error_negative_price_popup = new module.ErrorNegativePricePopupWidget(this, {}); + this.error_negative_price_popup.appendTo($('.point-of-sale')); + // -------- Misc --------- this.notification = new module.SynchNotificationWidget(this,{}); @@ -963,6 +966,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa 'error': this.error_popup, 'error-product': this.error_product_popup, 'error-session': this.error_session_popup, + 'error-negative-price': this.error_negative_price_popup, 'choose-receipt': this.choose_receipt_popup, }, default_client_screen: 'welcome', diff --git a/addons/point_of_sale/static/src/xml/pos.xml b/addons/point_of_sale/static/src/xml/pos.xml index cb4d90f1671..6171869cbb4 100644 --- a/addons/point_of_sale/static/src/xml/pos.xml +++ b/addons/point_of_sale/static/src/xml/pos.xml @@ -351,6 +351,14 @@ + + + +