/
options.js
45 lines (38 loc) · 1.32 KB
/
options.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/** @odoo-module **/
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
//--------------------------------------------------------------------------
/**
* @see this.selectClass for parameters
*/
allowRoomCreation(previewMode, widgetValue, params) {
return this.orm.write("event.event", [this.eventId], {
meeting_room_allow_creation: widgetValue,
});
},
//--------------------------------------------------------------------------
// Private
//--------------------------------------------------------------------------
/**
* @override
*/
async _computeWidgetState(methodName, params) {
switch (methodName) {
case 'allowRoomCreation': {
return this.meetingRoomAllowCreation;
}
}
return this._super(...arguments);
},
});