Hi. When we open calendar, the default calendar is the "Administrator", and i want to set "Everybody's calendar".
the code to this i think is in :
_loadFilter: function (filter) {
if (!filter.write_model) {
return;
}
var field = this.fields[filter.fieldName];
return this._rpc({
model: filter.write_model,
method: 'search_read',
domain: [["user_id", "=", session.uid]],
fields: [filter.write_field],
})
.then(function (res) {
var records = _.map(res, function (record) {
var _value = record[filter.write_field];
var value = _.isArray(_value) ? _value[0] : _value;
var f = _.find(filter.filters, function (f) {return f.value === value;});
var formater = fieldUtils.format[_.contains(['many2many', 'one2many'], field.type) ? 'many2one' : field.type];
return {
'id': record.id,
'value': value,
'label': formater(_value, field),
'active': !f || f.active,
};
});
records.sort(function (f1,f2) {
return _.string.naturalCmp(f2.label, f1.label);
});
// add my profile
if (field.relation === 'res.partner' || field.relation === 'res.users') {
var value = field.relation === 'res.partner' ? session.partner_id : session.uid;
var me = _.find(records, function (record) {
return record.value === value;
});
if (me) {
records.splice(records.indexOf(me), 1);
} else {
var f = _.find(filter.filters, function (f) {return f.value === value;});
me = {
'value': value,
'label': session.name + _t(" [Me]"),
'active': !f || f.active,
};
}
records.unshift(me);
}
// add all selection
records.push({
'value': value,
'label': field.relation === 'res.partner' || field.relation === 'res.users' ? _t("Everybody's calendars") : _t("Everything"),
'active': filter.all,
});
filter.filters = records;
});
},
Does anyone knows where can i change the default calendar in this code? Thanks