Skip to Content
Menu
This question has been flagged
3 Replies
1713 Views

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 

Avatar
Discard
Author Best Answer

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


Avatar
Discard

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

Author

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

Best Answer

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

Avatar
Discard
Best Answer

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

Avatar
Discard