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.

-1

How to set colspan value dynamically in qWeb?

By
Yulybaseball
on 11/10/14, 11:19 AM 1,736 views

Hello there:

I am trying to make an HTML report using qWeb in Odoo. Table I have to print has variable columns, and those columns have variable colspan values, so I defined a method in Python in order to return the header and colspan of that columns. Method returns something like this:

    OrderedDict({'header 1' : 6, 'header 2' : 6, 'header 3' : 2, 'resume' : 2})

In qWeb code I wrote this:

    <td align="center" style="border:1px solid black;" colspan="<t t-esc='partial_value' />" ><b><t t-raw="partial" /></b></td>

The name of the column (the header) is printed successfully, but the colspan value is raising an exception (XMLSyntaxError: Unescaped '<' not allowed in attributes values). I also tried tag t using t-esc... It raised same error.

So, how to set colspan value dynamically?

Thanks.

2
Sajin Aziz
On 11/12/14, 4:37 AM

Try this

<td align="center" style="border:1px solid black;"  t-att-colspan="partial_value" />" ><b><t t-raw="partial" /></b></td>

@Sajin Aziz: Thank you very much, it worked!!!

Yulybaseball
on 11/12/14, 9:30 AM

Thank you very much Sajin Aziz, it help me in rowspan.

Ubaid
on 10/19/16, 8:59 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: 11/10/14, 11:19 AM
Seen: 1736 times
Last updated: 3/16/15, 8:10 AM