HVH
HVH

Reputation: 247

How to hide certain columns in tree view based on selection field value?

I want to hide some fields based on the selection field .The fields are in tree view. neither the code attrs="{'invisible':[('od_term_line','not in',('month'))]}"

nor invisible="context.get('od_term_line','quart')", #quarts is the selection value in which the value should not be shown

invisible="context.get('od_term_line')!='month'" works

Thanks in advance

Upvotes: 2

Views: 914

Answers (1)

Sagar Poojara
Sagar Poojara

Reputation: 31

To use like this firstly you have to store the selection fields value in list then put the condition in attrs. It will surely work. Thanks

    #In python file.
    year = fields.Selection("put the all months here.")
    list1 = []
    for every_month in year:
        list1.append(every_month):


    <!--then condition like this in XML-->
<field attrs="{'invisible':[('january','not in',('year'))]}"/>

Upvotes: 2

Related Questions