From d30103c29e82375fdee2810d822d628ba26358f9 Mon Sep 17 00:00:00 2001 From: Frederic van der Essen Date: Thu, 13 Nov 2014 16:07:52 +0100 Subject: [PATCH] [FIX] point_of_sale: rounding error in discount computing + removing duplicated code --- addons/point_of_sale/static/src/js/models.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index 88d17b5d2bb..48b32d4a99e 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -810,10 +810,13 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal get_unit_price: function(){ return this.price; }, - get_display_price: function(){ + get_base_price: function(){ var rounding = this.pos.currency.rounding; return round_pr(round_pr(this.get_unit_price() * this.get_quantity(),rounding) * (1- this.get_discount()/100.0),rounding); }, + get_display_price: function(){ + return this.get_base_price(); + }, get_price_without_tax: function(){ return this.get_all_prices().priceWithoutTax; }, @@ -829,7 +832,7 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal get_all_prices: function(){ var self = this; var currency_rounding = this.pos.currency.rounding; - var base = round_pr(this.get_quantity() * this.get_unit_price() * (1.0 - (this.get_discount() / 100.0)), currency_rounding); + var base = this.get_base_price(); var totalTax = base; var totalNoTax = base;