[IMP] pos: use iot scale

Before this commit the continuous reading of the scale
was started directly in `show`.

In order for us to be able to use the scale with IoT drivers
this piece of code needs to be overriden, so it was moved to a separate function.

Task: 1892412
This commit is contained in:
pha-odoo
2019-07-17 08:02:13 +02:00
parent c4aade63fd
commit f87a443551
@@ -289,7 +289,6 @@ var ScaleScreenWidget = ScreenWidget.extend({
show: function(){
this._super();
var self = this;
var queue = this.pos.proxy_queue;
this.set_weight(0);
this.renderElement();
@@ -314,7 +313,12 @@ var ScaleScreenWidget = ScreenWidget.extend({
// add product *after* switching screen to scroll properly
self.order_product();
});
this._read_scale();
},
_read_scale: function() {
var self = this;
var queue = this.pos.proxy_queue;
queue.schedule(function(){
return self.pos.proxy.scale_read().then(function(weight){
self.set_weight(weight.weight);