diff --git a/addons/point_of_sale/static/src/js/screens.js b/addons/point_of_sale/static/src/js/screens.js index c58e7d860a0..71fdb3a5609 100644 --- a/addons/point_of_sale/static/src/js/screens.js +++ b/addons/point_of_sale/static/src/js/screens.js @@ -19,6 +19,8 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa var QWeb = instance.web.qweb, _t = instance.web._t; + var round_pr = instance.web.round_precision + module.ScreenSelector = instance.web.Class.extend({ init: function(options){ this.pos = options.pos; @@ -564,7 +566,20 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa this.$('.js-weight').text(this.get_product_weight_string()); }, get_product_weight_string: function(){ - return (this.weight || 0).toFixed(3) + ' Kg'; + var product = this.get_product(); + var defaultstr = (this.weight || 0).toFixed(3) + ' Kg'; + if(!product || !this.pos){ + return defaultstr; + } + var unit_id = product.uos_id || product.uom_id; + if(!unit_id){ + return defaultstr; + } + var unit = this.pos.units_by_id[unit_id[0]]; + var weight = round_pr(this.weight || 0, unit.rounding); + var weightstr = weight.toFixed(Math.ceil(Math.log(1.0/unit.rounding) / Math.log(10) )); + weightstr += ' Kg'; + return weightstr; }, get_product_image_url: function(){ var product = this.get_product(); diff --git a/addons/product/product_data.xml b/addons/product/product_data.xml index c1c0a577092..85462bb851d 100644 --- a/addons/product/product_data.xml +++ b/addons/product/product_data.xml @@ -28,6 +28,35 @@ Volume + + + + Product Price + 2 + + + Discount + 2 + + + Account + 2 + + + Stock Weight + 2 + + + Product Unit of Measure + + + + Product UoS + + + @@ -47,6 +76,7 @@ kg + @@ -211,30 +241,6 @@ parameter) will see those record just disappear. - - Product Price - 2 - - - Discount - 2 - - - Account - 2 - - - Stock Weight - 2 - - - Product Unit of Measure - - - - Product UoS - -