From 8ef1be2e42f3c060db61a1a5d6b463a1cf1a1fd5 Mon Sep 17 00:00:00 2001 From: Nikunj Ladava Date: Fri, 2 Aug 2019 06:36:43 +0000 Subject: [PATCH] [FIX] payment: prevent rpc fail event before this commit it shows error dialog when rpc fail after this commit, error dialog will not be shown to user, instead we have already shown error in payment form task- 2045189 closes odoo/odoo#39571 X-original-commit: e3644c6b59271c521abc151d3c533331836fdc90 Signed-off-by: Damien Bouvy (dbo) --- addons/payment/static/src/js/payment_form.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/payment/static/src/js/payment_form.js b/addons/payment/static/src/js/payment_form.js index 345b678d5bf..ce67b467108 100644 --- a/addons/payment/static/src/js/payment_form.js +++ b/addons/payment/static/src/js/payment_form.js @@ -246,6 +246,7 @@ publicWidget.registry.PaymentForm = publicWidget.Widget.extend({ // here we remove the 'processing' icon from the 'add a new payment' button self.enableButton(button); }).guardedCatch(function (error) { + error.event.preventDefault(); // if the rpc fails, pretty obvious self.enableButton(button); @@ -299,6 +300,7 @@ publicWidget.registry.PaymentForm = publicWidget.Widget.extend({ ); } }).guardedCatch(function (error) { + error.event.preventDefault(); self.displayError( _t('Server Error'), _t("We are not able to redirect you to the payment form.") + " " + @@ -426,6 +428,7 @@ publicWidget.registry.PaymentForm = publicWidget.Widget.extend({ $(button).children('.fa').addClass('fa-plus-circle'); $(button).find('span.o_loader').remove(); }).guardedCatch(function (error) { + error.event.preventDefault(); // if the rpc fails, pretty obvious $(button).attr('disabled', false); $(button).children('.fa').addClass('fa-plus-circle');