[fix] problem with numpad

bzr revid: nicolas.vanhoren@openerp.com-20111216162102-q1ic92it7hegcrvt
This commit is contained in:
niv-openerp 2011-12-16 17:21:02 +01:00
parent 7fe7189365
commit f807f2d692
1 changed files with 16 additions and 6 deletions

View File

@ -509,7 +509,8 @@ openerp.point_of_sale = function(db) {
},
initialize: function(options) {
this.shop = options.shop;
return this.shop.bind('change:selectedOrder', this.reset, this);
this.shop.bind('change:selectedOrder', this.changedSelectedOrder, this);
this.changedSelectedOrder();
},
appendNewChar: function(newChar) {
var oldBuffer;
@ -527,7 +528,7 @@ openerp.point_of_sale = function(db) {
buffer: (this.get('buffer')) + newChar
});
}
return this.updateTarget();
this.updateTarget();
},
deleteLastChar: function() {
var tempNewBuffer;
@ -538,7 +539,7 @@ openerp.point_of_sale = function(db) {
this.set({
buffer: tempNewBuffer
});
return this.updateTarget();
this.updateTarget();
},
switchSign: function() {
var oldBuffer;
@ -546,16 +547,25 @@ openerp.point_of_sale = function(db) {
this.set({
buffer: oldBuffer[0] === '-' ? oldBuffer.substr(1) : "-" + oldBuffer
});
return this.updateTarget();
this.updateTarget();
},
changeMode: function(newMode) {
return this.set({
this.set({
buffer: "0",
mode: newMode
});
},
changedSelectedOrder: function() {
if (this.currentSaleOrder) {
this.currentSaleOrder.unbind();
this.currentSaleOrder.get('orderLines').unbind();
}
this.currentSaleOrder = this.shop.get('selectedOrder');
this.currentSaleOrder.get('orderLines').bind('add', this.reset, this);
this.reset();
},
reset: function() {
return this.set({
this.set({
buffer: "0",
mode: "quantity"
});