From 351348fa9d7bb5908680759f85f1f1e432a21065 Mon Sep 17 00:00:00 2001 From: Khushi Date: Fri, 15 Mar 2024 05:43:50 +0000 Subject: [PATCH] [FIX] website_event_meet: community page customize options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Steps to reproduce: - Open an event and go to the Community page - Try to customize it => traceback on clicking the 'Customize' tab. Cause: The `_getRpcData` function called by '_computeWidgetState' method does not exist anymore since https://github.com/odoo/odoo/commit/03c5526 Fix: This commit eliminates the call to the `_getRpcData` function and alters the code of 'options.js' to get rpcData for the 'allow room creation' checkbox, through an implementation similar to that of 'website menu'. closes odoo/odoo#158684 Task: 3805901 X-original-commit: 1ea9c23eaaab15b6e29b73b9ec530fc9baec0726 Signed-off-by: Warnon Aurélien (awa) Signed-off-by: Khushi Patel (khpa) --- .../static/src/js/snippets/options.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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);