How to hide field from the specific user


I have a user to which i do not want to show product name in any module installed, however, I have a custom field which I am showing to user to identify product.

I did some R&D, and understood that I need to create a group in which I restrict user to not see specific field and add the user in it. But how I am confused how to achieve this. Please assist

1 Comment
1 Answer


If you need to hide a field from a specific user.Follow the steps below

Create a new user group for hiding the field and add the required user to that group.For creating a new user group you can follow the blog below

For example:

Create a category

<record model="ir.module.category" id="group_invoice_multi_approval">
<field name="name">Invoice Approval</field>
<field name="description">Access to the invoice approval menu</field>
<field name="sequence">3</field>

Create user group

<record id="product_user" model="res.groups">
name="name">Products Visibility</field>
name="category_id" ref="module_name.group_invoice_multi_approval"/>

Now we have a group named product visibility.Add your required user to this group.

Now inherit your required template like below for changing the attribute of the required field.

In the below code am hiding the product name for this user group

<record model="ir.ui.view" id="product_template_inherit">
<field name="name">account.move.approval.inherited</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_only_form_view"/>
<field name="groups_id" eval="[(6, 0, [ref('invoice_multi_approval.product_user') ])]"/>
<field name="arch" type="xml">
<field name="name" position="attributes">
<attribute name="invisible">True</attribute>

Specify the user group while inheriting the template.The above code will invisible product name for the user group Product visibility.