List views
At this point, list views should need little introduction, but we are still going to discuss the attributes that can be used with them. Here is an example of a list view for our To-Do Tasks:
<record id="view_tree_todo_task" model="ir.ui.view"> <field name="model">todo.task</field> <field name="arch" type="xml"> <tree decoration-muted="is_done" decoration-bf="state=='open'" delete="false"> <field name="name"/> <field name="user_id"/> <field name="is_done"/> <field name="state" invisible="1"/> </tree> </field> </record>
The row text color and font can change dynamically depending on the results of a Python expression evaluation. This is done through decoration–NAME
attributes, with the expression to evaluate based on field attributes. The NAME
part can be bf
or it
, for bold and italic fonts, or any Bootstrap text contextual colors: danger
, info
, muted...