Skip to Content
Menu
This question has been flagged
1 Reply
10398 Views

Hi,

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

Avatar
Discard
Best Answer

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

Avatar
Discard
Related Posts Replies Views Activity
1
May 21
8124
0
Oct 20
12
2
Aug 20
1762
2
Mar 15
3465
3
Mar 15
26679