From dbba492cb956b8f6cadaaff8641fae2d10d2d02f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20van=20der=20Essen?= Date: Wed, 23 May 2012 17:25:35 +0200 Subject: [PATCH] [FIX] point_of_sale: payment_screen remained visible after first order bzr revid: fva@openerp.com-20120523152535-o89hee21ztrn7e55 --- .../static/src/js/pos_screens.js | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/addons/point_of_sale/static/src/js/pos_screens.js b/addons/point_of_sale/static/src/js/pos_screens.js index 1bd44363ddc..5102e2d47f1 100644 --- a/addons/point_of_sale/static/src/js/pos_screens.js +++ b/addons/point_of_sale/static/src/js/pos_screens.js @@ -74,7 +74,6 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa return this; }, show_popup: function(name,message){ - console.log('show_popup:',message); if(this.current_popup){ this.close_popup(); } @@ -132,12 +131,18 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa }); module.ScreenWidget = module.PosBaseWidget.extend({ + init: function(parent,options){ + this._super(parent,options); + this.hidden = false; + }, show: function(){ + this.hidden = false; if(this.$element){ this.$element.show(); } }, hide: function(){ + this.hidden = true; if(this.$element){ this.$element.hide(); } @@ -148,6 +153,18 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa this.pos_widget.action_bar.destroy_buttons(); } }, + // we need this because some screens re-render themselves when they are hidden + // (due to some events, or magic, or both...) we must make sure they remain hidden. + // the good solution would probably be to make them not re-render themselves when they + // are hidden. + renderElement: function(){ + this._super(); + if(this.hidden){ + if(this.$element){ + this.$element.hide(); + } + } + }, }); module.PopUpWidget = module.ScreenWidget.extend({ @@ -182,11 +199,11 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa this._super(); var self = this; this.$element.find('.receipt').off('click').click(function(){ - console.log('receipt!'); //TODO + console.log('TODO receipt'); //TODO self.pos_widget.screen_selector.set_current_screen('scan'); }); this.$element.find('.invoice').off('click').click(function(){ - console.log('invoice!'); //TODO + console.log('TODO invoice'); //TODO self.pos_widget.screen_selector.set_current_screen('scan'); }); }, @@ -678,7 +695,6 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa show: function(){ this._super(); var self = this; - console.log('Payment Screen!'); this.pos_widget.set_numpad_visible(true); this.pos_widget.set_leftpane_visible(true); @@ -721,7 +737,6 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa this.currentOrderLines.bind('all', this.updatePaymentSummary, this); }, change_selected_order: function() { - console.log('change_selected_order'); this.currentPaymentLines.unbind(); this.bindPaymentLineEvents(); this.currentOrderLines.unbind(); @@ -729,7 +744,6 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa this.renderElement(); }, addPaymentLine: function(newPaymentLine) { - console.log('addPaymentLine:',newPaymentLine); var x = new module.PaymentlineWidget(null, { payment_line: newPaymentLine });