From 9cfe5665a5648693547da4bf0b0b9d2fb0547aaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20van=20der=20Essen?= Date: Fri, 31 Aug 2012 16:56:06 +0200 Subject: [PATCH] [DONE] point_of_sale: disable validation button when order not fully paid bzr revid: fva@openerp.com-20120831145606-nrk44gs60lab4k3l --- addons/point_of_sale/static/src/css/pos.css | 6 ++++-- addons/point_of_sale/static/src/js/screens.js | 6 +++++- addons/point_of_sale/static/src/js/widgets.js | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/addons/point_of_sale/static/src/css/pos.css b/addons/point_of_sale/static/src/css/pos.css index a9baf041942..bfe2ef7f9dc 100644 --- a/addons/point_of_sale/static/src/css/pos.css +++ b/addons/point_of_sale/static/src/css/pos.css @@ -1072,12 +1072,14 @@ -webkit-transition-timing-function: ease-out; } -.point-of-sale .pos-actionbar .button.disabled{ - color:#AAA; +.point-of-sale .pos-actionbar .button.disabled *{ + opacity: 0.5; } .point-of-sale .pos-actionbar .button.disabled:hover{ border: 1px solid #cacaca; border-radius: 4px; + color: #555; + cursor: default; background: #e2e2e2; background: -webkit-linear-gradient(#f0f0f0, #e2e2e2); diff --git a/addons/point_of_sale/static/src/js/screens.js b/addons/point_of_sale/static/src/js/screens.js index ff07da30822..9a2071c6335 100644 --- a/addons/point_of_sale/static/src/js/screens.js +++ b/addons/point_of_sale/static/src/js/screens.js @@ -741,6 +741,8 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa self.validateCurrentOrder(); }, }); + + this.updatePaymentSummary(); }, close: function(){ this._super(); @@ -807,7 +809,9 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa this.$('#payment-paid-total').html(paidTotal.toFixed(2)); this.$('#payment-remaining').html(remaining.toFixed(2)); this.$('#payment-change').html(change.toFixed(2)); - this.pos_widget.action_bar.set_button_disabled('validation', remaining > 0); + if(this.pos_widget.action_bar){ + this.pos_widget.action_bar.set_button_disabled('validation', remaining > 0); + } }, 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 5de1fd8b3fe..6de31c88dfd 100644 --- a/addons/point_of_sale/static/src/js/widgets.js +++ b/addons/point_of_sale/static/src/js/widgets.js @@ -433,7 +433,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa var button = new module.ActionButtonWidget(this,button_options); this.button_list.push(button); if(button_options.name){ - this.buttons[name] = button; + this.buttons[button_options.name] = button; } button.appendTo(this.$('.pos-actionbar-button-list')); return button;