From 74706e9e033e9a513eb18eb185c2ba30d83b2ebf Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Mon, 3 Jun 2019 11:09:25 +0000 Subject: [PATCH] [FIX]payment_paypal: wrong fees computation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Steps to reproduce the bug: - Create a product P with price=100€ - Configure payment aquier Paypal with fees_int_fixed = 1€ and fees_int_var = 1% - Set Paypal to be available in the website - Go to the web shop and add P in the cart - Choose to pay with Paypal Bug: The amout to pay was 102.02€ instead of 102.01€ Before the fix, the fees was computed as followed: fees = (percentage / 100.0 * amount + fixed) / (1 - percentage / 100.0) Where fees_dom_fixed = fixed and fees_int_var = percentage With this computation, the percentage was applied twice. If for example, we had fixed = 0 then fees = (percentage / 100.0 * amount) / (1 - percentage / 100.0) In this case, it's easy to see that the percentage is applied twice. opw:1981784 closes odoo/odoo#33830 Signed-off-by: Simon Goffin (sig) --- addons/payment_paypal/models/payment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/payment_paypal/models/payment.py b/addons/payment_paypal/models/payment.py index fb12cabdc50..f83129749a9 100644 --- a/addons/payment_paypal/models/payment.py +++ b/addons/payment_paypal/models/payment.py @@ -86,7 +86,7 @@ class AcquirerPaypal(models.Model): else: percentage = self.fees_int_var fixed = self.fees_int_fixed - fees = (percentage / 100.0 * amount + fixed) / (1 - percentage / 100.0) + fees = (percentage / 100.0 * amount) + fixed / (1 - percentage / 100.0) return fees @api.multi