diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py index 5683b40ff96..3728b958438 100644 --- a/addons/point_of_sale/point_of_sale.py +++ b/addons/point_of_sale/point_of_sale.py @@ -1335,9 +1335,9 @@ class pos_order_line(osv.osv): 'name': fields.char('Line No', required=True, copy=False), 'notice': fields.char('Discount Notice'), 'product_id': fields.many2one('product.product', 'Product', domain=[('sale_ok', '=', True)], required=True, change_default=True), - 'price_unit': fields.float(string='Unit Price', digits_compute=dp.get_precision('Account')), + 'price_unit': fields.float(string='Unit Price', digits_compute=dp.get_precision('Product Price')), 'qty': fields.float('Quantity', digits_compute=dp.get_precision('Product UoS')), - 'price_subtotal': fields.function(_amount_line_all, multi='pos_order_line_amount', digits_compute=dp.get_precision('Account'), string='Subtotal w/o Tax', store=True), + 'price_subtotal': fields.function(_amount_line_all, multi='pos_order_line_amount', digits_compute=dp.get_precision('Product Price'), string='Subtotal w/o Tax', store=True), 'price_subtotal_incl': fields.function(_amount_line_all, multi='pos_order_line_amount', digits_compute=dp.get_precision('Account'), string='Subtotal', store=True), 'discount': fields.float('Discount (%)', digits_compute=dp.get_precision('Account')), 'order_id': fields.many2one('pos.order', 'Order Ref', ondelete='cascade'), diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index f18059905e2..a85090647f9 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -1118,29 +1118,29 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal return this.get('name'); }, getSubtotal : function(){ - return (this.get('orderLines')).reduce((function(sum, orderLine){ + return round_pr((this.get('orderLines')).reduce((function(sum, orderLine){ return sum + orderLine.get_display_price(); - }), 0); + }), 0), this.pos.currency.rounding); }, getTotalTaxIncluded: function() { - return (this.get('orderLines')).reduce((function(sum, orderLine) { + return round_pr((this.get('orderLines')).reduce((function(sum, orderLine) { return sum + orderLine.get_price_with_tax(); - }), 0); + }), 0), this.pos.currency.rounding); }, getDiscountTotal: function() { - return (this.get('orderLines')).reduce((function(sum, orderLine) { + return round_pr((this.get('orderLines')).reduce((function(sum, orderLine) { return sum + (orderLine.get_unit_price() * (orderLine.get_discount()/100) * orderLine.get_quantity()); - }), 0); + }), 0), this.pos.currency.rounding); }, getTotalTaxExcluded: function() { - return (this.get('orderLines')).reduce((function(sum, orderLine) { + return round_pr((this.get('orderLines')).reduce((function(sum, orderLine) { return sum + orderLine.get_price_without_tax(); - }), 0); + }), 0), this.pos.currency.rounding); }, getTax: function() { - return (this.get('orderLines')).reduce((function(sum, orderLine) { + return round_pr((this.get('orderLines')).reduce((function(sum, orderLine) { return sum + orderLine.get_tax(); - }), 0); + }), 0), this.pos.currency.rounding); }, getTaxDetails: function(){ var details = {}; @@ -1164,9 +1164,9 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal return fulldetails; }, getPaidTotal: function() { - return (this.get('paymentLines')).reduce((function(sum, paymentLine) { + return round_pr((this.get('paymentLines')).reduce((function(sum, paymentLine) { return sum + paymentLine.get_amount(); - }), 0); + }), 0), this.pos.currency.rounding); }, getChange: function() { return this.getPaidTotal() - this.getTotalTaxIncluded();