Limiting access to fields (Odoo Studio)

Odoo Studio makes it easy to limit access to specific fields on a Form View.

For this example we’ll limit access to the product cost field

Enable Odoo Studio, click on the “Cost” field and properties are shown in the left-hand panel.

In the bottom left there is the field “Limit Visibility to groups”

For this example, we’ll only allow Sales Managers to see the cost. Of course you can select another group, or multiple groups.

That’s all you need to do.

Technical Notes

Behind the scenes, Odoo Studio creates an Extension View.

We can see this by enabling developer mode and navigating to Settings / Technical / Views. Search for views with “Studio” in the name and for the product.template model

This is an Extension View, and it inherits the product.template.product.form view. It’s a Form View for the product.template model

Architecture (XML)

<data>
   <xpath expr="//field[@name='standard_price']" position="attributes">
     <attribute name="groups">sales_team.group_sale_manager</attribute>
   </xpath>
</data>

sales_team.group_sale_manager is the Sales / Manager role.

Without Studio you could create an Extension View to do the same thing.

2 thoughts on “Limiting access to fields (Odoo Studio)

  1. Of course you can modify the Base View. It’s simpler and quicker but you need to think what will happen if you apply upgrades.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s