[FIX] point_of_sale: Fix down/up rounding
While using the cash rounding, there were issues when rounding up and down. The pre filled amount was correct but the rest of the transaction was wrong. (Wrong due, wrong change,...) This commit re calculate the rounding applied when using up or down payment. closes odoo/odoo#71298 X-original-commit: bfccdf07adba35a5838a35a7bba98a1d71c67d2f Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
This commit is contained in:
@@ -3315,12 +3315,19 @@ exports.Order = Backbone.Model.extend({
|
||||
if (utils.float_is_zero(rounding_applied, this.pos.currency.decimals)){
|
||||
// https://xkcd.com/217/
|
||||
return 0;
|
||||
} else if(this.pos.cash_rounding[0].rounding_method === "UP" && rounding_applied < 0) {
|
||||
}
|
||||
else if(this.pos.cash_rounding[0].rounding_method === "UP" && rounding_applied < 0 && remaining > 0) {
|
||||
rounding_applied += this.pos.cash_rounding[0].rounding;
|
||||
}
|
||||
else if(this.pos.cash_rounding[0].rounding_method === "DOWN" && rounding_applied > 0){
|
||||
else if(this.pos.cash_rounding[0].rounding_method === "UP" && rounding_applied > 0 && remaining < 0) {
|
||||
rounding_applied -= this.pos.cash_rounding[0].rounding;
|
||||
}
|
||||
else if(this.pos.cash_rounding[0].rounding_method === "DOWN" && rounding_applied > 0 && remaining > 0){
|
||||
rounding_applied -= this.pos.cash_rounding[0].rounding;
|
||||
}
|
||||
else if(this.pos.cash_rounding[0].rounding_method === "DOWN" && rounding_applied < 0 && remaining < 0){
|
||||
rounding_applied += this.pos.cash_rounding[0].rounding;
|
||||
}
|
||||
return sign * rounding_applied;
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user