Odoo Help


This community 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.


extend ListView.row to add "t-att-class" in "tr" root element (QWeb, odoo 8.0)

on 8/31/16, 4:25 AM 402 views

I want to do something like this, but it does not works:

<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<tr t-extend="ListView.row" t-att-class="view.class_for(record)">

Just want to add t-att-class to the tr element. The problem is that tr is the root node, and I cant figure out how to refer it for inheritance. Can someone help me?

The original template looks like this:

<tr t-name="ListView.row"
<t t-set="asData" t-value="record.toForm().data"/>
<t t-foreach="columns" t-as="column">
<td t-if="column.meta"> </td>
<th t-if="options.selectable" class="oe_list_record_selector" width="1">
<t t-set="checked" t-value="options.select_view_id == record.get('id') ? 'checked' : null"/>
<input t-if="options.radio" type="radio" name="radiogroup" t-att-checked="checked"/>
<input t-if="!options.radio" type="checkbox" name="radiogroup" t-att-checked="checked"/>
<t t-foreach="columns" t-as="column">
<t t-set="number" t-value="column.type === 'integer' or column.type == 'float'"/>
<t t-set="modifiers" t-value="column.modifiers_for(asData)"/>
<td t-if="!column.meta and column.invisible !== '1'" t-att-title="column.help"
t-attf-class="oe_list_field_cell oe_list_field_#{column.widget or column.type} #{number ? 'oe_number' : ''} #{column.tag === 'button' ? 'oe-button' : ''} #{modifiers.readonly ? 'oe_readonly' : ''} #{modifiers.required ? 'oe_required' : ''}"
><t t-raw="render_cell(record, column)"/></td>
<td t-if="options.deletable" class='oe_list_record_delete' width="13px">
<button type="button" name="delete" class="oe_i">d</button>

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


Asked: 8/31/16, 4:25 AM
Seen: 402 times
Last updated: 8/31/16, 4:39 AM