[FIX] payment: open redirection in top window

When [1] was merged, it did not adapt correctly external providers
redirections. As now the /shop pages can be viewed inside an iframe, the
external redirections must be opened in the top window.

[1]: https://github.com/odoo/odoo/commit/31cc10b91dc7762e23b4bde9b945be0c4ce3fe3b

task-2687506

closes odoo/odoo#102723

X-original-commit: 3a32b9e1efa6277b345dc9239334680651690df7
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
Younn Olivier
2022-10-08 18:57:08 +02:00
parent 5dd70ed8b6
commit 35789f9ab4
@@ -395,6 +395,8 @@ odoo.define('payment.payment_form_mixin', require => {
const $redirectForm = $(processingValues.redirect_form_html).attr(
'id', 'o_payment_redirect_form'
);
// Ensures external redirections when in an iframe.
$redirectForm[0].setAttribute('target', '_top');
$(document.getElementsByTagName('body')[0]).append($redirectForm);
// Submit the form
@@ -433,7 +435,7 @@ odoo.define('payment.payment_form_mixin', require => {
_setPaymentFlow: function (flow = 'redirect') {
if (flow !== 'redirect' && flow !== 'direct' && flow !== 'token') {
console.warn(
`payment_form_mixin: method '_setPaymentFlow' was called with invalid flow:
`payment_form_mixin: method '_setPaymentFlow' was called with invalid flow:
${flow}. Falling back to 'redirect'.`
);
this.txContext.flow = 'redirect';