Hi,
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
https://www.cybrosys.com/blog/how-to-create-security-group-odoo-13
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>
</record>
Create user group
<record id="product_user" model="res.groups">
<field name="name">Products Visibility</field>
<field name="category_id" ref="module_name.group_invoice_multi_approval"/>
</record>
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>
</field>
</field>
</record>
Specify the user group while inheriting the template.The above code will invisible product name for the user group Product visibility.
Regards
Hope this will get into:
1- http://learnopenerp.blogspot.com/2016/10/how-to-visible-and-invisible-fields-in.html
To get login user group:
2- https://learnopenerp.blogspot.com/2017/10/how-to-check-login-user-group-in-odoo.html