Odoo Help

1

1
4 Risposte
1
Antuan Cuba
09/01/17, 05:37

Hi Dhinesh,

I have tried your code but does not work for me. Currently I am using this approach that adds the class property at td level, but what I want is to add it at tr level:


<t t-extend="ListView.row">
  <t t-jquery="td[t-att-data-field='column.id']">
  this.attr('t-attf-class', this.attr('t-attf-class') + ' #{view.class_for(record)}');
  </t>
</t>
1
Fatih Piristine Finlandia
24/07/17, 13:51

try this one. if not working, dig into manual deeper from v7.

<t t-extend="ListView.row">
<xpath expr="//tr[@t-name='Listview.row']" position="attributes">
<attribute name="t-att-class">view.class_for(record)</attribute> <xpath>
</t>
0
DenisK Germania
09/04/19, 04:42

Its a litte bit late but maybe it will help someone who is also stumbling over this topic.

I'm using the following code to add custom CSS to the rows and to the cells:

<t t-extend="ListView.row">
    <t t-jquery="tr">
        this.context.setAttribute('t-att-class', 'view.class_for(record)');
    </t>
  <t t-jquery="td[t-att-data-field='column.id']">
      this.attr('t-attf-class', this.attr('t-attf-class') + ' {{view.class_for_cell(record, column)}}');
  </t>
</t>

The method "class_for_cell" is an own function to extract the information from the field and set the specific class to the cell.

Working with V8.

0
Avatar

Dhinesh India

--Dhinesh--
3925
| 6 5 11
Pondicherry, India
--Dhinesh--

Stack: Python/Odoo/AWS/Redis/Linux/Nginx/Docker/Django/Eclipse

Dhinesh India
13/12/16, 14:47

Hi,

You can just use the Qweb Js inheritance by extending the t-name and adding the new class like below:

<?xml version="1.0" encoding="UTF-8"?>
<templates>
    <t t-extend="ListView.row">
        <t t-jquery="tr[t-att-data-id*='record.get('id')']">
            this.attr('t-attf-class', this.attr("t-attf-class") + 'view.class_for(record)');
        </t>
    </t>
</templates>
Fai una domanda
Writer
Keep Informed
2 follower(s)
About This Community

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

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now