From 424b110eb048861bb47d95a14e576b46757eed63 Mon Sep 17 00:00:00 2001 From: Sylvain LE GAL Date: Tue, 19 May 2020 15:23:22 +0200 Subject: [PATCH] [FIX] remove tareStr that was generating warning in Odoo Logs --- pos_tare/static/src/js/models.js | 16 ++++++---------- pos_tare/static/src/xml/pos_tare.xml | 2 +- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/pos_tare/static/src/js/models.js b/pos_tare/static/src/js/models.js index 36eacebd..31a66844 100644 --- a/pos_tare/static/src/js/models.js +++ b/pos_tare/static/src/js/models.js @@ -15,27 +15,23 @@ odoo.define('pos_tare.models', function (require) { // ///////////////////////////// initialize: function (session, attributes) { this.tare = 0; - this.tareStr = '0'; return _super_.initialize.call(this, session, attributes); }, init_from_JSON: function (json) { _super_.init_from_JSON.call(this, json); this.tare = json.tare ||0; - this.tareStr = json.tareStr ||'0'; }, clone: function () { var orderline = _super_.clone.call(this); orderline.tare = this.tare; - orderline.tareStr = this.tareStr; return orderline; }, export_as_JSON: function () { var json = _super_.export_as_JSON.call(this); json.tare = this.get_tare(); - json.tareStr = this.get_tare_str(); return json; }, @@ -79,7 +75,6 @@ odoo.define('pos_tare.models', function (require) { } // Update tare value. this.tare = tare_in_product_uom; - this.tareStr = tare_in_product_uom_string; // Update the quantity with the new weight net of tare quantity. this.set_quantity(net_quantity); this.trigger('change', this); @@ -89,13 +84,14 @@ odoo.define('pos_tare.models', function (require) { return this.tare; }, - get_tare_str: function () { - return this.tareStr; - }, - get_tare_str_with_unit: function () { var unit = this.get_unit(); - return this.tareStr + ' ' + unit.name; + var tare_str = pos_tare_tools.format_tare( + this.pos, + this.tare, + this.get_unit(), + ); + return tare_str + ' ' + unit.name; }, }); diff --git a/pos_tare/static/src/xml/pos_tare.xml b/pos_tare/static/src/xml/pos_tare.xml index f3fe16dc..34dc8e32 100644 --- a/pos_tare/static/src/xml/pos_tare.xml +++ b/pos_tare/static/src/xml/pos_tare.xml @@ -21,7 +21,7 @@ - +
  • Tare :