Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
3 Odpowiedzi
1736 Widoki

lass AmountLimit(models.Model): _name = 'amount.approval' _description = 'Amount Approval' user_id = fields.Many2one(comodel_name="res.users", string='Name', required=True) amount = fields.Float('Amount Limit') this is my amount.approval model here is menu access_amount_approval,access_amount_approval,model_amount_approval,base.group_user,1,1,1,1 here is security access now this amount limit menu i want to see only for admin access only admin can see this menu 
how I do this?
please help me 

Awatar
Odrzuć
Autor Najlepsza odpowiedź

DO I need to create any group for this?
if yes
then How I do this 

          parent="menu_multi_approval" sequence="110"
action="amount_approver_limit_action"
/>
here is my menu can you give me whatother I need to do
full guideline or full code


Awatar
Odrzuć

You dont need to create just use the existing groups, use any one: base.group_erp_manager (Access rights) or base.group_system (Settings)

add groups="base.group_erp_manager"

so now your menu should look like as follows:

parent="menu_multi_approval" sequence="110"
action="amount_approver_limit_action" groups="base.group_erp_manager"

after the change upgrade the module

Autor

I update with your recommendation code
After that what should I do ?

Najlepsza odpowiedź

Hi,

You can set the groups attribute for the menu item, so that the menu wont be accessible by other users.
If you set a group for the menu, only the users in the group will see the menu item.

This can be done from the user interface and as well as code. So here you can either assign the base.group_erp_manager (Access rights) or base.group_system (Settings) group for the menu.

Sample:

    id="crm_config_settings_menu"
name="Settings"
parent="crm_menu_config"
action="crm.crm_config_settings_action"
groups="base.group_system"
sequence="0"/>


Similarly if the model data also has to be access only by admin, you can change group assigned in the access right also, change the base.group_user from the csv (access rights) to the admin group.



Thanks

Awatar
Odrzuć
Najlepsza odpowiedź

Hi,
If you want to restrict a menu item to specific groups, you can add a 'groups' attribute to the menuitem component.

 For example:

<menuitem
    id="calendar_appointment_type_menu_action"
    parent="calendar.mail_menu_calendar"
    name="Calendar"
    sequence="3"
    action="calendar.action_calendar_event"
    groups="base.group_erp_manager"/>



Now, the menu item will only be visible to users belonging to the 'base.group_erp_manager' group.

Hope it helps

Awatar
Odrzuć