From c2cd71f576303bb68d0c76f683c490ba2fe10ea1 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Fri, 20 Mar 2020 15:17:01 +0000 Subject: [PATCH] [FIX] payment_sips: rounding error - Activate SIPS - Make a payment of 263.90 on the eCommerce The SO is not confirmed because there is 0.01 of difference. This is due to the fact that 263.90 * 100 = 26389.9999... Using `round` instead of `int` prevents truncating the value. opw-2179123 closes odoo/odoo#48169 X-original-commit: 60f9cea444df37e685b7f4312c9ff28c395822b3 Signed-off-by: Nicolas Martinelli (nim) --- addons/payment_sips/models/payment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/payment_sips/models/payment.py b/addons/payment_sips/models/payment.py index 34078fdcb36..186c82363fd 100644 --- a/addons/payment_sips/models/payment.py +++ b/addons/payment_sips/models/payment.py @@ -73,7 +73,7 @@ class AcquirerSips(models.Model): currency_code = CURRENCY_CODES.get(currency.name, False) if not currency_code: raise ValidationError(_('Currency not supported by Wordline')) - amount = int(values['amount'] * 100) + amount = round(values['amount'] * 100) if self.state == 'enabled': # For production environment, key version 2 is required merchant_id = getattr(self, 'sips_merchant_id')