[FIX] website_event: prevent crash if clicking on register too soon
Since https://github.com/odoo/odoo/commit/02dab5dc88112fd5f5ee43882ca022529acb4abf, the JS is now lazy loaded. As the "Register Now" button on each event page relies on JavaScript to perform a RPC, it needs the JS to be loaded to be able to work properly when clicking on it. In this case, clicking on it while the JS is not loaded yet performs a standard form submit, which lands on a route which cannot handle a standard form submit which then results in a 400 error page. This commit fixes the problem by adding the 'o_wait_lazy_js' class on the button which simply prevents click on elements during lazy loading. Discovered while working on task-2043872 closes odoo/odoo#37675 X-original-commit: https://github.com/odoo/odoo/commit/5e885436f9a77b4c387cd0b1eb07102ff85bec03 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
@@ -580,7 +580,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-4 pt-3 pt-lg-0 pl-2 pl-lg-0">
|
||||
<button type="submit" class="btn btn-primary btn-block a-submit" t-attf-id="#{event.id}">Register</button>
|
||||
<button type="submit" class="btn btn-primary o_wait_lazy_js btn-block a-submit" t-attf-id="#{event.id}">Register</button>
|
||||
</div>
|
||||
</div>
|
||||
<div t-if="description" class="row mx-0">
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
</div>
|
||||
<div class="row no-gutters">
|
||||
<div class="col-md-4 offset-md-8 py-2 pl-md-0 pr-md-2">
|
||||
<button type="submit" class="btn btn-primary btn-block a-submit" t-att-disabled="not tickets_available or None" t-attf-id="#{event.id}">Register</button>
|
||||
<button type="submit" class="btn btn-primary o_wait_lazy_js btn-block a-submit" t-att-disabled="not tickets_available or None" t-attf-id="#{event.id}">Register</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user