Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
11919 Visualizzazioni

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
Abbandona
Risposta migliore

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
Abbandona
Post correlati Risposte Visualizzazioni Attività
1
mag 21
9718
0
ott 20
12
2
ago 20
2936
2
mar 15
4563
3
mar 15
28629