[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) <dbo@odoo.com>
This commit is contained in:
Nikunj Ladava
2019-10-30 12:06:20 +00:00
committed by fw-bot
parent 6456434382
commit 8ef1be2e42
@@ -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');