Odoo Help


How to make a field invisible for certain groups

Shawn Varghese
on 7/6/15, 5:30 AM 6,289 views

This question seems to have been asked before, but I couldn't get the answers to work.

I have a field - amount_words. It should be invisible only to one group and visible to all others. This is what I have done so far:

 <record id="view_order_line_tree2" model="ir.ui.view">
    <field name="name">sale.order.line.tree.inherit</field>
    <field name="model">sale.order</field>
    <field name="inherit_id" ref="sale.view_order_form"/>
    <field name="arch" type="xml">
        <xpath expr="//page/group" position="after"> <group class="oe_subtotal_amount_footer oe_left"> <field name="amount_words" /> </group> </xpath> </field> </record>

This is to introduce the amount_words field.

Now, to hide it for the service_order group:

 <record id="view_order_line_tree3" model="ir.ui.view">
    <field name="name">sale.order.line.tree.inherit2</field>
    <field name="model">sale.order</field>
    <field name="inherit_id" ref="view_order_line_tree2"/>
    <field name="groups_id" eval="[(6, 0, [ref('custom_sale.group_service_order') ])]"/>
    <field name="arch" type="xml">
	<field name="amount_words" position="attributes">
	    <attribute name="attrs">{'invisible':1}</attribute>

But the effect is that it is now invisible for all groups. Does anyone know how to achieve this?

Kalpana Hemnani
On 7/6/15, 12:06 PM

Hello Shawn,

You can use 'groups' for number of groups you want to show this field just like below:

<field name="amount_words" position="attributes">

    <attribute name="groups">other_than_service_order_group_name</attribute>


After doing this, field will only be seen to groups you have mentioned in group attribute.

Hope this helps!


Kalpana Hemnani


Thanks Kalpana, but here I would have to assign the majority of my users to a separate group which seems unnecessary. I have commented in the other post. Please let me know in case you have any other suggestions.

ePillars Systems LLC, Shawn Varghese
on 7/6/15, 12:49 PM
Farid Ghanchi
On 7/7/15, 2:14 AM

Dear Shawn,

You can create a new wizard, And in this wizard you can choose a User/Customer (Specific User) and on this User/Customer give a access to this new field is visible or invisible. 


Farid Ghanchi


Solanki Shamji

--Solanki Shamji--

| 5 2 7
Baroda, India
--Solanki Shamji--


Solanki Shamji
On 7/6/15, 11:35 AM


Please check the this url.


Hope this will help you.



Thanks Solanki, but I think the link describes how to display it for a certain group. In my case, there are only very few users who should not see the field, so I created a group for that purpose. The workaround would be to create a separate group, assign everyone else to that group and apply groups to that. But that would be a tedious task and not the ideal way to do it. I think the code snippet that I posted with some tweaks should accomplish the task. Please let me know if you have any other ideas.

ePillars Systems LLC, Shawn Varghese
on 7/6/15, 12:47 PM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 7/6/15, 5:30 AM
Seen: 6289 times
Last updated: 7/7/15, 2:14 AM