[FIX] website_event_meet: community page customize options

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) <awa@odoo.com>
Signed-off-by: Khushi Patel (khpa) <khpa@odoo.com>
This commit is contained in:
Khushi
2024-03-22 07:00:45 +00:00
parent 811d2c90ea
commit 351348fa9d
@@ -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);