Skip to content
Snippets Groups Projects
Commit 76ccaaf0 authored by rhe-odoo's avatar rhe-odoo
Browse files

[FIX] pos_cash_rounding: Fix value under rounding


It should be allowed to pay amount that are not rounded if the value is less than the rounding value.
Ex:
Rounding value: 0.05
Amount to pay: 0.04
The amount to pay should remain 0.04 and not be rounded to 0.05.

This fix allows the user to pay for values under the rounding value without applying the rounding.

closes odoo/odoo#81302

Signed-off-by: default avatarMasereel Pierre <pim@odoo.com>
parent d2c58a9d
No related branches found
No related tags found
No related merge requests found
......@@ -63,6 +63,8 @@ models.Order = models.Order.extend({
if (utils.float_is_zero(rounding_applied, this.pos.currency.decimals)){
// https://xkcd.com/217/
return 0;
} else if(this.get_total_with_tax() < this.pos.cash_rounding[0].rounding) {
return 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 === "UP" && rounding_applied > 0 && remaining < 0) {
......@@ -86,6 +88,8 @@ models.Order = models.Order.extend({
for(var id in this.get_paymentlines()) {
var line = this.get_paymentlines()[id];
var diff = round_pr(round_pr(line.amount, cash_rounding) - round_pr(line.amount, default_rounding), default_rounding);
if(this.get_total_with_tax() < this.pos.cash_rounding[0].rounding)
return true;
if(diff && line.payment_method.is_cash_count) {
return false;
} else if(!this.pos.config.only_round_cash_method && diff) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment