[FIX] point_of_sale: scale debug was not working with an unplugged scale

This commit is contained in:
Frédéric van der Essen 2015-01-27 10:58:45 +01:00
parent 0b18a5afec
commit 932257150b
1 changed files with 5 additions and 4 deletions

View File

@ -370,13 +370,14 @@ function openerp_pos_devices(instance,module){ //module is instance.point_of_sal
scale_read: function(){
var self = this;
var ret = new $.Deferred();
console.log('scale_read');
if (self.use_debug_weight) {
return (new $.Deferred()).resolve({weight:this.debug_weight, unit:'Kg', info:'ok'});
}
this.message('scale_read',{})
.then(function(weight){
console.log(weight)
ret.resolve(self.use_debug_weight ? self.debug_weight : weight);
ret.resolve(weight);
}, function(){ //failed to read weight
ret.resolve(self.use_debug_weight ? self.debug_weight : {weight:0.0, unit:'Kg', info:'ok'});
ret.resolve({weight:0.0, unit:'Kg', info:'ok'});
});
return ret;
},