From f87a44355170b828ed5be64539bc67d088346be6 Mon Sep 17 00:00:00 2001 From: pha-odoo Date: Thu, 4 Jul 2019 15:12:35 +0200 Subject: [PATCH] [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 --- addons/point_of_sale/static/src/js/screens.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/point_of_sale/static/src/js/screens.js b/addons/point_of_sale/static/src/js/screens.js index 7cd57158f22..010b77c2bf1 100644 --- a/addons/point_of_sale/static/src/js/screens.js +++ b/addons/point_of_sale/static/src/js/screens.js @@ -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);