From 124be154bfbdfdad750f0e7d0cab7b7d50e5a6b9 Mon Sep 17 00:00:00 2001 From: Romain Derie Date: Thu, 28 Jun 2018 14:28:17 +0200 Subject: [PATCH] [FIX] sale_payment: back to SO page after payment Commit a3c9c286cc made stripe.js more generic. By doing so it also fixed the `provider_form.innerHTML = data` that was not doing anything since provider_form was not a dom element. For orders on /my/orders/XX, the `return_url` was /my/orders/XX before going through stripe.js. stripe.js would then call `/pay/sale/XX/form_tx/` that would return new acquirer form values that should replace the old ones, including a new `return_url`. But since `provider_form.innerHTML` was undefined, the old data would remains. With commit a3c9c286cc the data is now correctly replacing the old ones. The `return_url` is now /my. So when an user pays a SO, he is redirected to the portal root page instead of the SO he just paid with a confirmation message (like it was the case before the stripe.js improvement). This fix ensure that the user is still redirect to his SO, by redirecting to /my/orders/xxx and not /my. --- addons/sale_payment/controllers/payment.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/sale_payment/controllers/payment.py b/addons/sale_payment/controllers/payment.py index 3ebd7373ec7..2d61ab91666 100644 --- a/addons/sale_payment/controllers/payment.py +++ b/addons/sale_payment/controllers/payment.py @@ -16,7 +16,8 @@ class PaymentPortal(http.Controller): :return html: form containing all values related to the acquirer to redirect customers to the acquirer website """ - success_url = kwargs.get('success_url', '/my') + success_url = '/my/orders/%s?access_token=%s' % (order_id, access_token) if access_token else '/my/orders/%s' % order_id + success_url = kwargs.get('success_url', success_url) callback_method = kwargs.get('callback_method', '') order_sudo = request.env['sale.order'].sudo().browse(order_id)