From 076a795796463abed7d61d3a50ecbedd8ef63faa Mon Sep 17 00:00:00 2001 From: Juliana Date: Thu, 26 Aug 2021 16:02:57 +0200 Subject: [PATCH] =?UTF-8?q?[FIX]Probleme=20de=20tare=20envoy=C3=A9e=20a=20?= =?UTF-8?q?la=20balance?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/src/js/container.js | 40 ++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/static/src/js/container.js b/static/src/js/container.js index 657db2f..f112552 100644 --- a/static/src/js/container.js +++ b/static/src/js/container.js @@ -39,16 +39,32 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require) var scale_screen = this.gui.screen_instances['balancescale']; var price = scale_screen.format_price(scale_screen.get_product_price()); - queue.schedule(function () { - return self.pos.proxy.scale_read_data_price(price).then(function (scale_answer) { - self.set_weight(scale_answer.weight); - // self.set_price(scale_answer.price); - if ((scale_answer.error === '30' || scale_answer.error === '31') && scale_answer.weight !== 0) { - self.set_weight(0); - } - }); - }, {duration: 500, repeat: true}); - // } +// Problème de tare + if (container) { + // format tare + var tare = this.format_tare(container); + queue.schedule(function () { + return self.pos.proxy.scale_read_data_price_tare(price, tare).then(function (scale_answer) { + self.set_weight(scale_answer.weight); + + if ((scale_answer.error === '30' || scale_answer.error === '31') && scale_answer.weight !== 0) { + self.set_weight(0); + self.pos.proxy.reset_tare(); + } + }); + }, {duration: 500, repeat: true}); + + } else { + queue.schedule(function () { + return self.pos.proxy.scale_read_data_price(price).then(function (scale_answer) { + self.set_weight(scale_answer.weight); + // self.set_price(scale_answer.price); + if ((scale_answer.error === '30' || scale_answer.error === '31') && scale_answer.weight !== 0) { + self.set_weight(0); + } + }); + }, {duration: 500, repeat: true}); + } } this._super(); @@ -517,7 +533,7 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require) }); this.$('.back').click(function(){ - self.gui.show_screen('presentation'); + self.gui.show_screen('presentation', {container: null}); }); // Ajout pour le pb de tare @@ -913,7 +929,7 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require) // self.set_weight(0); self.set_price(0); self.pos.proxy.reset_tare(); - self.gui.show_screen('presentation'); + self.gui.show_screen('presentation', {container: null}); }); $("#pos-header-text-confirm").removeClass('oe_hidden');