[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.
This commit is contained in:
Romain Derie
2018-06-28 18:48:04 +02:00
parent 0ea864ca90
commit 124be154bf
+2 -1
View File
@@ -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)