Odoo Help


Different way to hide the field ?

on 3/15/16, 9:45 AM 945 views

I know by using 

attribute tag we can hide the field in the form

<attribute name="invisible">1<attribute/>

and giving the security groups for the record we can achieve it, like

<field name="groups" eval="[(4,ref('base.group_user'))]"/>

is there any other way to hide the field ?




| 6 5 7
Tbilisi, Georgia
On 3/15/16, 11:26 AM

You can hide fields depending on the value of other field(s) in the same view. 

for example (see the source):

<field name="valuation" attrs="{'invisible':[('type', 'in', ('service', 'consu'))]}"/>

here, field "valuation" is hidden when value of the "type" field is one of 'service' or 'consu'. You can use more complex domains as well.

So, except of options you listed, there is possibility to hide fields conditionally, based on other field's values.

One more options is "states", used to hide fields/Buttons in a header mainly, see the source

<button name="button_reset_taxes" states="draft,proforma2"
                                        string="(update)" class="oe_link oe_edit_only"
                                        type="object" help="Recompute taxes and total"/>
here states="draft,proforma" means that the button is visible only when document is in the one of "draft" or "proforma2" state. So it's hidden if the document is in different states. You can consider this as one more way hide ( at least for buttons, I have not triedit for field, but it may hide field as well, you can try )
on 3/15/16, 11:38 AM

normally you can also manipulate readonly flag for fields, depending on state, not only the visibility

on 3/15/16, 11:44 AM

*url for the first comment (copy-paste mistake) see the source here: https://github.com/odoo/odoo/blob/f66fcf97b244ed41a77cd9353e7cba34695c41b4/addons/account/account_invoice_view.xml#L222-L224

on 3/15/16, 11:48 AM

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: 3/15/16, 9:45 AM
Seen: 945 times
Last updated: 3/15/16, 11:26 AM