From 5dc389db6bc0e0cded74a49cbfb3b15371ee8aec Mon Sep 17 00:00:00 2001 From: jev-odoo Date: Fri, 30 Aug 2019 14:06:36 +0000 Subject: [PATCH] [FIX] point_of_sale: use currency precision to test if orders are paid MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The test was made with an epsilon of 0.00001, which is precise enough to avoid false positives, but allowing false negatives. As a results, some orders can be incorrectly determined unpaid. No (non-digital) currency has a precision higher than 0.00001, but many currencies have a precision much lower (e.g the unit for ¥). Also, we prepare for the future where all orders will be paid in Bitcoin. opw 2059997 closes odoo/odoo#37112 X-original-commit: 73c2d46f4a443885fbf67879141ac892efebe3c7 Signed-off-by: Nans Lefebvre (len) --- addons/point_of_sale/models/pos_order.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/point_of_sale/models/pos_order.py b/addons/point_of_sale/models/pos_order.py index cdd15360bb8..78cef18257b 100644 --- a/addons/point_of_sale/models/pos_order.py +++ b/addons/point_of_sale/models/pos_order.py @@ -786,7 +786,7 @@ class PosOrder(models.Model): for order in self: if order.lines and not order.amount_total: continue - if (not order.lines) or (not order.statement_ids) or (abs(order.amount_total - order.amount_paid) > 0.00001): + if (not order.lines) or (not order.statement_ids) or (not float_is_zero((order.amount_total - order.amount_paid), precision_rounding=order.pricelist_id.currency_id.rounding)): return False return True