[IMP] point_of_sale: auto focus on paymentlines
authorFrédéric van der Essen <fva@openerp.com>
Wed, 14 Nov 2012 16:50:43 +0000 (17:50 +0100)
committerFrédéric van der Essen <fva@openerp.com>
Wed, 14 Nov 2012 16:50:43 +0000 (17:50 +0100)
bzr revid: fva@openerp.com-20121114165043-vbfj1r93ww3es9qt

addons/point_of_sale/static/src/js/screens.js
addons/point_of_sale/static/src/js/widgets.js

index 0b8ab70..d8e5306 100644 (file)
@@ -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) {
index bc5f296..94d6a5d 100644 (file)
@@ -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);