Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
1 Beantwoorden
11968 Weergaven

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
Annuleer
Beste antwoord

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
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
1
mei 21
9763
0
okt. 20
12
2
aug. 20
2985
2
mrt. 15
4596
3
mrt. 15
28686