summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRomain Derie <rde@odoo.com>2018-06-28 14:28:17 +0200
committerRomain Derie <rde@odoo.com>2018-06-28 18:48:04 +0200
commit124be154bfbdfdad750f0e7d0cab7b7d50e5a6b9 (patch)
treeb7c9a0f73cdec048bb0d3a7a03f29d3be7aac6db
parent0ea864ca9056ab0abb3bc9cf06a55f8ba86ae0f9 (diff)
[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.
-rw-r--r--addons/sale_payment/controllers/payment.py3
1 files changed, 2 insertions, 1 deletions
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)