Search code examples
odooopenerp-7openerp-8

Openerp: How to restrict custom button for management user group view and click only?


I am using OpenERP 7. I having a question that how to restrict my custom button such as "Approve" button to be available for management group users to view and click only?

For example: Let's say i have three state in a form workflow which are New->Confirm->Approved

The general user can view and click "Confirm" to enter the state from New to Confirm.

However in the state "Confirm", the button "Approve" will only available by management group user. In other words, the general users will not able to see "Approve" button.

After management group user click "Approve" button, the state will become "Aprroved".

Question:

How can i make the "Approve" button only available for management users ?

Thanks !


Solution

  • You can give access to visible/click button for specific group. you just need to add group where you have define button.

    Let's say i have a button 'action_button_confirm' that only visible to sales managers. So, We can add Sales Manager group in button.

    Example:

    <button name="action_button_confirm" 
       string="Confirm Sale" 
       type="object" 
       groups="base.group_sale_manager"/>
    

    Hope this helps.