[FIX] website_event_meet: fix crash when creating event meeting room

To reproduce:

- Log-in as admin
- Switch to debug mode

- Go to Events / Configuration / Event Templates
- Create a new template:
  * Name: Online Conference
- Check 'Website menu', 'Community' and 'Allow Room Creation' option,
- Save it

- Go to Events / Events
- Create a new event:
  * Name: New Online Conference
  * Template: Online Conference
- Save it and click on 'Go to Website' smartbutton
- Then click on 'Community' submenu
- In the right panel, click on "Create a Room"

It crashes with:
```
TypeError: ctx.widget is undefined
    template@.../web/assets/1/debug/web.assets_frontend_lazy.js line 13622 > Function:26:29 (/web/static/lib/owl/owl.js:5532)
    render@.../web/assets/1/debug/web.assets_frontend_lazy.js:66320:28 (/web/static/src/core/utils/render.js:56)
    renderToElement@.../web/assets/1/debug/web.assets_frontend_lazy.js:66272:22 (/web/static/src/core/utils/render.js:8)
    _onClickCreate@.../web/assets/1/debug/web.assets_frontend_lazy.js:132115:35 (/website_event_meet/static/src/js/website_event_create_meeting_room_button.js:25)
```

This revert odoo/odoo@065a2f451a change for `website_event_meet`, as
in that case the `csrf_token` value is provided directly as context
value to `renderToElement` (see `websiteEventCreateMeetingRoom`
publicwidget `_onClickCreate` handler)

closes odoo/odoo#151761

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
Xavier ALT
2024-01-31 13:47:12 +00:00
parent ab0e0f4bef
commit 88783d3c12
2 changed files with 1 additions and 2 deletions
@@ -19,7 +19,6 @@ publicWidget.registry.websiteEventMeetingRoom = publicWidget.Widget.extend({
start: function () {
this._super.apply(this, arguments);
this.csrf_token = odoo.csrf_token;
this.meetingRoomId = parseInt(this.$el.data('meeting-room-id'));
},
@@ -41,7 +41,7 @@
</select>
</div>
<input name="event" t-att-value="event" type="hidden"/>
<input name="csrf_token" t-att-value="widget.csrf_token" type="hidden"/>
<input name="csrf_token" t-att-value="csrf_token" type="hidden"/>
</form>
</main>
<footer class="modal-footer justify-content-start">