From 8e0a75ba15b1fa3602038c00706e4d95bb62d89a Mon Sep 17 00:00:00 2001 From: "Nasreddin (bon)" Date: Fri, 23 Apr 2021 00:39:21 +0000 Subject: [PATCH] [FIX] payment: enable pay button when clicking back button Issue Use Safari (or equivalent) browser - Install e-commerce - Go to Website -> Configuration -> Payment Acquirers - Activate Ingenico in test mode (write aaa in required fields) - Go to shop, and add product to card - Go to checkout - Select Ingenico payment mode - Click on Pay button - When on the ingenico page, press back The page is blocked and the button is disabled. Cause When clicking on Pay button, the page is locked and the button is disabled. With Chrome, when coming back to previous page, this one is regenerated and therefore adapt the button. In Safari, it is not the case. Solution On `pageshow` event, if event have `persisted` attribute set to to true, meaning using cache, then reload page. Fixes https://github.com/odoo/odoo/issues/69453 opw-2510281 closes odoo/odoo#70906 X-original-commit: c89224940bcc59aab4bddefa95b2b0ef7713e02f Signed-off-by: Romain Derie Signed-off-by: bon-odoo --- addons/payment/static/src/js/payment_form_mixin.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/payment/static/src/js/payment_form_mixin.js b/addons/payment/static/src/js/payment_form_mixin.js index 4550262bb60..c9bfba7d44e 100644 --- a/addons/payment/static/src/js/payment_form_mixin.js +++ b/addons/payment/static/src/js/payment_form_mixin.js @@ -13,6 +13,11 @@ odoo.define('payment.payment_form_mixin', require => { */ start: async function () { await this._super(...arguments); + window.addEventListener('pageshow', function (event) { + if (event.persisted) { + window.location.reload(); + } + }); this.$('[data-toggle="tooltip"]').tooltip(); this.txContext = {}; Object.assign(this.txContext, this.$el.data());