Commit 53993ff4 authored by Romain Courteaud's avatar Romain Courteaud

slapos_accounting: prevent rounding issues

parent 3080252f
...@@ -10,4 +10,10 @@ if amount < 1: ...@@ -10,4 +10,10 @@ if amount < 1:
use_list = ['use/trade/sale', 'use/trade/discount_service'] use_list = ['use/trade/sale', 'use/trade/discount_service']
amount = sum([delivery.getTotalPrice(use=use_list) for delivery in delivery_list]) amount = sum([delivery.getTotalPrice(use=use_list) for delivery in delivery_list])
return amount == context.getTotalPrice(use=use_list) currency = invoice.getPriceCurrencyValue()
if currency is None:
# completely random...
precision = 100
else:
precision = currency.getQuantityPrecision()
return round(amount, precision) == round(context.getTotalPrice(use=use_list), precision)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment