diff --git a/pos_tare/__manifest__.py b/pos_tare/__manifest__.py
index 285edc05..da757731 100644
--- a/pos_tare/__manifest__.py
+++ b/pos_tare/__manifest__.py
@@ -13,7 +13,8 @@
"demo": ["demo/uom_uom.xml"],
"data": [
"views/templates.xml",
- "views/pos_config_view.xml",
+ "views/view_pos_config.xml",
+ "views/view_pos_order.xml",
"data/barcode_rule.xml",
],
"qweb": [
diff --git a/pos_tare/models/__init__.py b/pos_tare/models/__init__.py
index c81866fd..c6acc897 100644
--- a/pos_tare/models/__init__.py
+++ b/pos_tare/models/__init__.py
@@ -1,2 +1,3 @@
from . import pos_config
+from . import pos_order_line
from . import barcode_rule
diff --git a/pos_tare/models/pos_order_line.py b/pos_tare/models/pos_order_line.py
new file mode 100644
index 00000000..c86e6260
--- /dev/null
+++ b/pos_tare/models/pos_order_line.py
@@ -0,0 +1,15 @@
+# Copyright (C) 2020-Today: GRAP ()
+# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
+
+from odoo import models, fields
+from odoo.addons import decimal_precision as dp
+
+
+class PosOrderLine(models.Model):
+ _inherit = "pos.order.line"
+
+ tare = fields.Float(
+ string="Tare",
+ digits=dp.get_precision("Product Unit of Measure")
+ )
diff --git a/pos_tare/static/src/js/models.js b/pos_tare/static/src/js/models.js
index 6ac96d35..f594ccd9 100644
--- a/pos_tare/static/src/js/models.js
+++ b/pos_tare/static/src/js/models.js
@@ -14,28 +14,28 @@ odoo.define('pos_tare.models', function (require) {
// Overload Section
// /////////////////////////////
initialize: function (session, attributes) {
- this.tareQuantity = 0;
- this.tareQuantityStr = '0';
+ 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.tareQuantity = json.tareQuantity ||0;
- this.tareQuantityStr = json.tareQuantityStr ||'0';
+ this.tare = json.tare ||0;
+ this.tareStr = json.tareStr ||'0';
},
clone: function () {
var orderline = _super_.clone.call(this);
- orderline.tareQuantity = this.tareQuantity;
- orderline.tareQuantityStr = this.tareQuantityStr;
+ orderline.tare = this.tare;
+ orderline.tareStr = this.tareStr;
return orderline;
},
export_as_JSON: function () {
var json = _super_.export_as_JSON.call(this);
- json.tareQuantity = this.get_tare();
- json.tareQuantityStr = this.get_tare_str();
+ json.tare = this.get_tare();
+ json.tareStr = this.get_tare_str();
return json;
},
@@ -78,24 +78,24 @@ odoo.define('pos_tare.models', function (require) {
this.get_quantity_str_with_unit()));
}
// Update tare value.
- this.tareQuantity = tare_in_product_uom;
- this.tareQuantityStr = tare_in_product_uom_string;
+ 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);
},
get_tare: function () {
- return this.tareQuantity;
+ return this.tare;
},
get_tare_str: function () {
- return this.tareQuantityStr;
+ return this.tareStr;
},
get_tare_str_with_unit: function () {
var unit = this.get_unit();
- return this.tareQuantityStr + ' ' + unit.name;
+ return this.tareStr + ' ' + unit.name;
},
});
diff --git a/pos_tare/views/pos_config_view.xml b/pos_tare/views/view_pos_config.xml
similarity index 100%
rename from pos_tare/views/pos_config_view.xml
rename to pos_tare/views/view_pos_config.xml
diff --git a/pos_tare/views/view_pos_order.xml b/pos_tare/views/view_pos_order.xml
new file mode 100644
index 00000000..7df2e933
--- /dev/null
+++ b/pos_tare/views/view_pos_order.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+ pos.order
+
+
+
+
+
+
+
+
+