Skip to Content
Menu
This question has been flagged
2168 Views

Hi,

 

I want to display an icon button on kanban view and if the user clicks the button I want it to change color to orange

 

I know I can use t-att-style="'color:orange;'" to change the buttons color, but how do I use t-att-style with an IF ?

 

XML:

≤div class="oe_kanban_bottom_right text-muted">
    ≤button name="action_change_color"             type="object"                      class="oe_read_only btn fa fa-file"                      t-att-style="'color:orange' if button_was_clicked else 'color:black'"
    />
≤/div>

Python:

def action_change_color(self):
    for order in self:
        if order.button_was_clicked:        
            order.update({'button_was_clicked': False})
        else:               order.update({'button_was_clicked': True})


What am I doing wrong?


Avatar
Discard