From 35789f9ab40788fcdb0088e8c44d1367bcc7efed Mon Sep 17 00:00:00 2001 From: Younn Olivier Date: Tue, 4 Oct 2022 13:39:24 +0000 Subject: [PATCH] [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) --- addons/payment/static/src/js/payment_form_mixin.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/payment/static/src/js/payment_form_mixin.js b/addons/payment/static/src/js/payment_form_mixin.js index e617afcc43f..5d6ddb7de57 100644 --- a/addons/payment/static/src/js/payment_form_mixin.js +++ b/addons/payment/static/src/js/payment_form_mixin.js @@ -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';