[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>
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user