Odoo Help


Dynamicly hide fields and rows in tree view odoo 9

on 11/16/16, 12:12 PM 809 views

I have model to store training results for athletes and tree view to insert results from

what I need is to create a button where it's function is : onClick , it filters the visibility of the shown columns in the tree view according to the exercise state ; so that if the exercise state's value is "by_distance" then it shows only the column that holds the values of by distance
Also the visibility have to be automatically changed so that if the exercise state becomes "by_weight" it changes to it and so on .

code :

class GeneralFitnessDetails(Model):
_name = 'general_fitness_details'
    generalFitnessDetails = Many2one("general_fitness")
    player = Many2one('player')
    exercise = Many2one("exercise")
    exercise_state = Selection([('by_reps', 'By Reps'),
                                ('by_time', 'By Time'),
                                ('by_distance', 'By Distance'),
                                 ('by_weight', 'By Weight')])
    reps = Integer(string='Reps')
    time_sec = Integer(string='Seconds')
    weight = Integer(string='Weight/KG')
    distance = Integer(string='Distance/Meters')

    <field name="player"/>
    <field name="exercise"/>
    <field name="exercise_state"/>
    <field name="reps" invisible="[('exercise_state', '=', 'by_reps')]"/>
    <field name="time_sec" invisible="[('exercise_state', '=', 'by_time')]"/>
    <field name="weight" invisible="[('exercise_state', '=', 'by_weight')]"/>
    <field name="distance" invisible="[('exercise_state', '=', 'by_distance')]"/>

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: 11/16/16, 12:12 PM
Seen: 809 times
Last updated: 11/16/16, 2:45 PM