From 1c14419e93ff925f2f6b9d51b243dfc20bfbc455 Mon Sep 17 00:00:00 2001 From: Jason Van Malder Date: Fri, 31 Jan 2020 14:19:19 +0000 Subject: [PATCH] [FIX] payment_stripe: fix traceback when error has no event Issue - Install eCommerce - Add Stripe - Pay with invalid cart Traceback Cause When I improved stripe error, I didn't checked if an error could have no event Solution Check if the error has an event OPW-2186385 closes odoo/odoo#44414 X-original-commit: 772c02743b5e6610a75e65e408c956eb6057a47d Signed-off-by: Jason Van Malder (jvm) --- addons/payment_stripe/static/src/js/payment_form.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/payment_stripe/static/src/js/payment_form.js b/addons/payment_stripe/static/src/js/payment_form.js index 5ed4200a88c..311f62bfc8e 100644 --- a/addons/payment_stripe/static/src/js/payment_form.js +++ b/addons/payment_stripe/static/src/js/payment_form.js @@ -81,7 +81,9 @@ PaymentForm.include({ }).guardedCatch(function (error) { // We don't want to open the Error dialog since // we already have a container displaying the error - error.event.preventDefault(); + if (error.event) { + error.event.preventDefault(); + } // if the rpc fails, pretty obvious self.enableButton(button); self.displayError(