Odoo Help

Welcome!

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.

0

How add the same attribute to all matched items of an xpath query (not only to the first)?

By
int_tow
on 2/23/16, 7:29 AM 478 views

I want add the same attribute to all matched items of an xpath query inside a  inherited qweb report template.

My code only change the colour of "1. aaa" to red. (the first matched item)

I can use "/*[@class='test_class'][2]" for the second item, but this is not a solution there are to many items with "test_class" inside the inherited report.

 

<template id="test_report_document_raw">

     <h2 class="test_class">1. aaa</h2>

     <h2 class="test_class">2. bbb</h2>

     <h2 class="test_class">3. ccc</h2>

     ...

</template>


<template id="test_report_document" inherit_id="test.test_report_document_raw" primary="True">

     <xpath expr="//*[@class='test_class']" position="attributes">

          <attribute name="style">color: red;</attribute>

       </xpath>

</template

odoo will take the first one only !

Jérémy Kersten (jke)
on 2/23/16, 8:14 AM

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)

Stats

Asked: 2/23/16, 7:29 AM
Seen: 478 times
Last updated: 2/23/16, 8:06 AM