[IMP] point_of_sale: reworked the way the weighting debug mode works to make it more robust
bzr revid: fva@openerp.com-20130708145522-6r5yedizrg9h6m0r
This commit is contained in:
parent
3c7ec1fa87
commit
4f51882863
|
@ -12,6 +12,8 @@ function openerp_pos_devices(instance,module){ //module is instance.point_of_sal
|
|||
|
||||
this.weight = 0;
|
||||
this.weighting = false;
|
||||
this.debug_weight = 0;
|
||||
this.use_debug_weight = false;
|
||||
|
||||
this.paying = false;
|
||||
this.default_payment_status = {
|
||||
|
@ -92,38 +94,36 @@ function openerp_pos_devices(instance,module){ //module is instance.point_of_sal
|
|||
// and a weighting_end()
|
||||
weighting_read_kg: function(){
|
||||
var self = this;
|
||||
if(this.bypass_proxy){
|
||||
return this.weight;
|
||||
}else{
|
||||
this.message('weighting_read_kg',{})
|
||||
.done(function(weight){
|
||||
if(self.weighting && !self.bypass_proxy){
|
||||
this.message('weighting_read_kg',{})
|
||||
.done(function(weight){
|
||||
if(self.weighting){
|
||||
if(self.use_debug_weight){
|
||||
self.weight = self.debug_weight;
|
||||
}else{
|
||||
self.weight = weight;
|
||||
}
|
||||
});
|
||||
return this.weight;
|
||||
}
|
||||
}
|
||||
});
|
||||
return this.weight;
|
||||
},
|
||||
|
||||
// sets a custom weight, ignoring the proxy returned value.
|
||||
debug_set_weight: function(kg){
|
||||
this.bypass_proxy = true;
|
||||
this.weight = kg;
|
||||
this.use_debug_weight = true;
|
||||
this.debug_weight = kg;
|
||||
},
|
||||
|
||||
// resets the custom weight and re-enable listening to the proxy for weight values
|
||||
debug_reset_weight: function(){
|
||||
this.bypass_proxy = false;
|
||||
this.weight = 0;
|
||||
this.use_debug_weight = false;
|
||||
this.debug_weight = 0;
|
||||
},
|
||||
|
||||
// the client has finished weighting products
|
||||
weighting_end: function(force){
|
||||
if(!this.bypass_proxy || force){
|
||||
this.weight = 0;
|
||||
this.weighting = false;
|
||||
this.message('weighting_end');
|
||||
}
|
||||
weighting_end: function(){
|
||||
this.weight = 0;
|
||||
this.weighting = false;
|
||||
this.message('weighting_end');
|
||||
},
|
||||
|
||||
// the pos asks the client to pay 'price' units
|
||||
|
|
|
@ -459,7 +459,6 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
|
|||
icon: '/point_of_sale/static/src/img/icons/png48/go-previous.png',
|
||||
click: function(){
|
||||
clearInterval(this.intervalID);
|
||||
self.pos.proxy.weighting_end();
|
||||
self.pos_widget.screen_selector.set_current_screen(self.previous_screen);
|
||||
}
|
||||
});
|
||||
|
@ -527,7 +526,6 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
|
|||
},
|
||||
order_product: function(){
|
||||
var weight = this.pos.proxy.weighting_read_kg();
|
||||
this.pos.proxy.weighting_end('true');
|
||||
this.pos.get('selectedOrder').addProduct(this.get_product(),{ quantity:weight });
|
||||
},
|
||||
get_product_name: function(){
|
||||
|
|
|
@ -743,6 +743,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
|
|||
}
|
||||
});
|
||||
this.$('.button.reset_weight').click(function(){
|
||||
self.$('input.weight').val('');
|
||||
self.pos.proxy.debug_reset_weight();
|
||||
});
|
||||
this.$('.button.custom_ean').click(function(){
|
||||
|
|
Loading…
Reference in New Issue