From 08ceeaf81b154a1f285cad6a8e392954836ea0d0 Mon Sep 17 00:00:00 2001
From: "Andrea Grazioso (agr-odoo)" <agr@odoo.com>
Date: Thu, 23 Apr 2020 06:25:01 +0000
Subject: [PATCH] [FIX] point_of_sale,pos_cash_rounding: fix change error popup
 on checkout
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Configure your POS with bank payment method only
Make a sale with rounding necessary (i.e. 1,29€)
The amount will be rounded. Go through the payment screen.

Error message will appear because no payment methods available is
capable of handling the change, but this is not necessary since we are
rounding.

Splitting the code to add a more specific condition in pos_cash_rounding
fix the issue

opw-2239946

closes odoo/odoo#50216

X-original-commit: 6131534da2d3a3bf75529b32f2061d58e925b365
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
---
 addons/point_of_sale/static/src/js/screens.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/addons/point_of_sale/static/src/js/screens.js b/addons/point_of_sale/static/src/js/screens.js
index 7725f9bea74d..e15c49971a50 100644
--- a/addons/point_of_sale/static/src/js/screens.js
+++ b/addons/point_of_sale/static/src/js/screens.js
@@ -2299,7 +2299,7 @@ var PaymentScreenWidget = ScreenWidget.extend({
         }
 
         // The exact amount must be paid if there is no cash payment method defined.
-        if (Math.abs(order.get_total_with_tax() - order.get_total_paid()) > 0.00001) {
+        if (Math.abs(order.get_total_with_tax() - order.get_total_paid() + order.get_rounding_applied()) > 0.00001) {
             var cash = false;
             for (var i = 0; i < this.pos.payment_methods.length; i++) {
                 cash = cash || (this.pos.payment_methods[i].is_cash_count);
-- 
GitLab