summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjev-odoo <jev@odoo.com>2019-08-30 14:06:36 +0000
committerfw-bot <otis@odoo.com>2019-09-19 08:16:19 +0000
commit5dc389db6bc0e0cded74a49cbfb3b15371ee8aec (patch)
tree2d68bfaf0818d65d0fab12f1f44e8a4d4b678f84
parentebda1101e379e55a02beec27c453e63e2178af2d (diff)
[FIX] point_of_sale: use currency precision to test if orders are paid
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) <len@odoo.com>
-rw-r--r--addons/point_of_sale/models/pos_order.py2
1 files changed, 1 insertions, 1 deletions
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