[FIX] point_of_sale: rounding error in discount computing + removing duplicated code

This commit is contained in:
Frederic van der Essen 2014-11-13 16:07:52 +01:00
parent e826e84af5
commit d30103c29e
1 changed files with 5 additions and 2 deletions

View File

@ -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;