For more complex logic, we can store the result of an expression into a variable to use it later in the template. This is to be done using the t-set directive, naming the variable to set followed by the t-value directive with the expression calculating the value to assign.
As an example, the following code renders missed deadlines in red, just as in the previous section, but uses a red_or_black variable for the CSS class to use, as shown in the following:
<t t-set="red_or_black" t-value=" record.date_deadline.raw_value and record.date_deadline.raw_value lte (new Date()) ? 'oe_kanban_text_red' : ''" /> <li t-att-class="red_or_black"> <field name="date_deadline" /> </li>
Variables can also be assigned HTML content, ...