-1

I am working with one2many list view and there is a state column in that i want to add custom css based on state of the object. Like if state is Completed make the text bold and background green somthing like that for other states. I tried but didn't found any way to add custom css or css classes based on condition. So i am now trying to extend list view in javascript and then i will loop through all rows and then add colors on them . Is this possible in Odoo ?

Ancient
  • 3,007
  • 14
  • 55
  • 104

1 Answers1

0

This can help if you want to change the entire row:

<field name="line_ids" >
    <tree string="Lines" colors="red:state=='completed'" fonts="bold:state=='completed'">
        <field name="name"/>
        <field name="employee_id"/>
        <field name="state"/>
    </tree>
</field>

But if you want to change just one column maybe this post can help you: Bold in listview for many records

I hope I've helped.

Dayana
  • 1,500
  • 1
  • 16
  • 29
  • this color property is used to change the color of text not background ... is there any other property for background ? – Ancient Aug 22 '17 at 16:50
  • Try this app: [link](https://apps.openerp.com/apps/modules/8.0/web_tree_dynamic_colored_field/) , but I think it only works with fields, not for the entire record. – Dayana Aug 22 '17 at 17:07