Skip to Content
Menu
This question has been flagged
1 Reply
2760 Views

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...

Avatar
Discard
Author

Anyone that can help me out?

Have you found a working solution, Robert?

Best Answer

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.

Avatar
Discard
Related Posts Replies Views Activity
1
May 25
1852
3
Aug 24
2092
0
Dec 23
1380
1
Apr 23
12515
1
Jan 23
2513