跳至内容
菜单
此问题已终结
1 回复
3328 查看

Hello there,


We make use of the calendar, with the Google sync as well for the managers...


Is there anyone who can tell me how to do the following;


I want to have a team of managers to be able to view the calendars of all users

Meanwhile the "normal" employees should only be able to see their own calendar of appointments in the calendar for which they are invited... So they shouldn't be able to filter on "everybody's calendar" and they shouldn't be able to add anyone from te managers group to their calendar view...


I tried to play with the record rules and acces rights but i broke our local installation several times doing so. On Google i just don't get any further. Is this even possible?

Anyone who can help me out? We are using Odoo 16 community edition.


Thanks in advance...

形象
丢弃
编写者

Anyone that can help me out?

Have you found a working solution, Robert?

最佳答案

Assuming you are working in Odoo version 18.

Go to server_v18/addons/web/static/src/views/calendar/calendar_model.js

Find this block inside the loadFilterSection method:

const previousAllFilter = previousFilters.find((f) => f.type === "all");

filters.push(this.makeFilterAll(previousAllFilter, isUserOrPartner, filterInfo.label));

Replace it with:

const previousAllFilter = previousFilters.find((f) => f.type === "all");

// Check group before adding the "Everybody's calendars" filter
let shouldShowAllFilter = true;

if (isUserOrPartner) {
    shouldShowAllFilter = await user.hasGroup("your_module.group_everybody_calendar");
}

if (shouldShowAllFilter) {
    const allFilter = this.makeFilterAll(previousAllFilter, isUserOrPartner, filterInfo.label);
    if (allFilter) {
        filters.push(allFilter);
    }
}

Now only if the user is the memer of this group (e.g. "your_module_name.group_everybody_calendar"), then only this filter "Everybody's calendars" will be visible to them.

形象
丢弃
相关帖文 回复 查看 活动
1
7月 25
211
2
6月 25
617
1
5月 25
2286
3
8月 24
2495
0
12月 23
1704