[FIX] website_event: traceback on register button
How to reproduce the bug ======================== 1.Open the register page of an event 2.Do not pick any ticket 3.Click Register => an traceback is raised Technical ========= '?.length > 0' statement was checking the length of the array instead of the values of the array. This issue comes after this https://github.com/odoo/odoo/pull/120437 After this commit: ================== Now the traceback will not raise. Task-3329432 closes odoo/odoo#126352 X-original-commit: 1c47606cf1cd56c4d0980c7419c508e37c90f58f Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
This commit is contained in:
@@ -44,8 +44,10 @@ var EventRegistrationForm = Widget.extend({
|
||||
$('#registration_form select').each(function () {
|
||||
post[$(this).attr('name')] = $(this).val();
|
||||
});
|
||||
var tickets_ordered = Object.values(post).map((value) => parseInt(value))?.length > 0;
|
||||
if (!tickets_ordered) {
|
||||
|
||||
// "post" looks like: { nb_register-9: "2", nb_register-10: "0" }
|
||||
const noTicketsOrdered = Object.values(post).map((value) => parseInt(value)).every(value => value === 0);
|
||||
if (noTicketsOrdered) {
|
||||
$('<div class="alert alert-info"/>')
|
||||
.text(_t('Please select at least one ticket.'))
|
||||
.insertAfter('#registration_form table');
|
||||
|
||||
Reference in New Issue
Block a user