From 2cf55fe3de1cb3e64cae1061977d173587395e0a Mon Sep 17 00:00:00 2001 From: Romain Derie Date: Fri, 23 Jun 2023 17:00:01 +0000 Subject: [PATCH] [FIX] website_payment: prevent donation form to crash when field error When a field had an error (required, wrong format etc), upon submission of the form there would be a JS traceback preventing the page to work anymore (the Donate button would spin forever). This is because the code was not adapted to the Bootstrap 5 migration. It seems like this code to update the config's content is not required anymore, as without it the content is correctly updated through the existing `.popover()` call a line above. You can ensure that by simply omitting your email and send the form, it will tell you that the email is required. Then just type "a" in the email field and send again, it will tell you that the format is not correct. Somehow, it seems to also be the case in Odoo 15 in Bootstrap 4, removing those line do not break that. Some fixes were made at [1] and [2] about the same issue but somehow people just fixed their own case, while grepping `.config.content` would have easily found this one too. [1]: https://github.com/odoo/odoo/commit/37546006940f99c8860e89997ed7a623abd5fa72 [2]: https://github.com/odoo/odoo/commit/0cff1dc2967cafeb8964ed0802c309d3bb7f7525 opw-3381196 closes odoo/odoo#126444 X-original-commit: 9e46ceea801d5044f5db4fee65d5980c64cfa23b Signed-off-by: Romain Derie (rde) --- addons/website_payment/static/src/js/website_payment_form.js | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/website_payment/static/src/js/website_payment_form.js b/addons/website_payment/static/src/js/website_payment_form.js index b13ba8d5245..a72cf572e0a 100644 --- a/addons/website_payment/static/src/js/website_payment_form.js +++ b/addons/website_payment/static/src/js/website_payment_form.js @@ -54,7 +54,6 @@ checkoutForm.include({ const $field = this.$('input[name="' + id + '"],select[name="' + id + '"]'); $field.addClass('is-invalid'); $field.popover({content: errorFields[id], trigger: 'hover', container: 'body', placement: 'top'}); - $field.data("bs.popover").config.content = errorFields[id]; } this._displayError( _t("Validation Error"),