|
@ -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; |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
}); |
|
|
}); |
|
|