This question has been flagged

Hi all, I would like to do some access control for my custom module but the problem is these roles/groups need to be somehow exclusive. Here is what I want:

    I have 5 menuitem, No.1, No.2, No.3, No.4 and No.5.

    And I would like have groups G, A, Manager, and Admin.

    For G group, they are able to enter No.1 and No.2 menu.

    For A group, they can enter No.4 and No.5 menu.

    For Manager group, only No.3 is needed.

    For Admin(superuser), of course, all of it

What I have tried is set groups="" on each menuitem in the view.xml file, and also added all of groups into corresponding security.xml  Everything seems good except Manager group.

    Current: Manager group can see No.1, No.2 and No.3 menu

    Expect: Manager group can see No.3 only

Is it because manager is a keyword for Odoo? Or what I should do to achieve it? Any hint will be useful! Thank a lot!

Avatar
Discard
Author

I understand that Admin role will be only one. And as you can see, I want manager(or whatever name it is, as long as role play is the same) can be multiple

Author

For more information, under setting --> user, it will automatically add G group if I select Manager group. Even I try un-click G group manually, it will add again, not working in this way.

Hi, after activating developer mode go to menu settings -> Users -> groups. Then open the group of your Manager, Then in the Inherited tab in the page, you can see that G is inherited by Manager, just remove the G from inherited and see

Author

Thx for apply, I see what you mean, but then another thing confusing me. If my understanding is correct, this inherit group function is triggered by "implied_ids", but in my code, I comment it out at first place. So, It looks like Odoo inherit it by default (like I said, maybe "Manager"is a keyword?), or is it about database didn't update? Thus, in coding aspect, I should add something like(3, ref('module_name.group_name) to remove the relation between them, right? If so, can you provide more information on this ref(0 1 2 3 4 5 6, "") with some example?