Browse Source

[FIX] remove tareStr that was generating warning in Odoo Logs

pull/501/head
Sylvain LE GAL 5 years ago
parent
commit
424b110eb0
  1. 16
      pos_tare/static/src/js/models.js
  2. 2
      pos_tare/static/src/xml/pos_tare.xml

16
pos_tare/static/src/js/models.js

@ -15,27 +15,23 @@ odoo.define('pos_tare.models', function (require) {
// ///////////////////////////// // /////////////////////////////
initialize: function (session, attributes) { initialize: function (session, attributes) {
this.tare = 0; this.tare = 0;
this.tareStr = '0';
return _super_.initialize.call(this, session, attributes); return _super_.initialize.call(this, session, attributes);
}, },
init_from_JSON: function (json) { init_from_JSON: function (json) {
_super_.init_from_JSON.call(this, json); _super_.init_from_JSON.call(this, json);
this.tare = json.tare ||0; this.tare = json.tare ||0;
this.tareStr = json.tareStr ||'0';
}, },
clone: function () { clone: function () {
var orderline = _super_.clone.call(this); var orderline = _super_.clone.call(this);
orderline.tare = this.tare; orderline.tare = this.tare;
orderline.tareStr = this.tareStr;
return orderline; return orderline;
}, },
export_as_JSON: function () { export_as_JSON: function () {
var json = _super_.export_as_JSON.call(this); var json = _super_.export_as_JSON.call(this);
json.tare = this.get_tare(); json.tare = this.get_tare();
json.tareStr = this.get_tare_str();
return json; return json;
}, },
@ -79,7 +75,6 @@ odoo.define('pos_tare.models', function (require) {
} }
// Update tare value. // Update tare value.
this.tare = tare_in_product_uom; this.tare = tare_in_product_uom;
this.tareStr = tare_in_product_uom_string;
// Update the quantity with the new weight net of tare quantity. // Update the quantity with the new weight net of tare quantity.
this.set_quantity(net_quantity); this.set_quantity(net_quantity);
this.trigger('change', this); this.trigger('change', this);
@ -89,13 +84,14 @@ odoo.define('pos_tare.models', function (require) {
return this.tare; return this.tare;
}, },
get_tare_str: function () {
return this.tareStr;
},
get_tare_str_with_unit: function () { get_tare_str_with_unit: function () {
var unit = this.get_unit(); 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;
}, },
}); });

2
pos_tare/static/src/xml/pos_tare.xml

@ -21,7 +21,7 @@
<t t-extend="Orderline"> <t t-extend="Orderline">
<t t-jquery=".info-list:last-child" t-operation="append"> <t t-jquery=".info-list:last-child" t-operation="append">
<t t-if="line.get_tare_str() !== '0'">
<t t-if="line.get_tare() !== 0">
<li class="info"> <li class="info">
<i class="fa fa-beer"/> <i class="fa fa-beer"/>
Tare : <t t-esc="line.get_tare_str_with_unit()" /> Tare : <t t-esc="line.get_tare_str_with_unit()" />

Loading…
Cancel
Save