diff --git a/addons/website_event_meet/static/src/js/snippets/options.js b/addons/website_event_meet/static/src/js/snippets/options.js index 29e18044806..798afb1ae18 100644 --- a/addons/website_event_meet/static/src/js/snippets/options.js +++ b/addons/website_event_meet/static/src/js/snippets/options.js @@ -4,6 +4,16 @@ import options from '@web_editor/js/editor/snippets.options'; options.registry.WebsiteEvent.include({ + /** + * @override + */ + async start() { + const res = await this._super(...arguments); + const rpcData = await this.orm.read("event.event", [this.eventId], ["meeting_room_allow_creation"]); + this.meetingRoomAllowCreation = rpcData[0]['meeting_room_allow_creation']; + return res; + }, + //-------------------------------------------------------------------------- // Options //-------------------------------------------------------------------------- @@ -12,7 +22,7 @@ options.registry.WebsiteEvent.include({ * @see this.selectClass for parameters */ allowRoomCreation(previewMode, widgetValue, params) { - this.orm.write(this.modelName, [this.eventId], { + this.orm.write("event.event", [this.eventId], { meeting_room_allow_creation: widgetValue, }).then(() => this.trigger_up('request_save', {reload: true, optionSelector: this.data.selector})); }, @@ -27,7 +37,7 @@ options.registry.WebsiteEvent.include({ async _computeWidgetState(methodName, params) { switch (methodName) { case 'allowRoomCreation': { - return this._getRpcData('meeting_room_allow_creation'); + return this.meetingRoomAllowCreation; } } return this._super(...arguments);