How To Set Colspan Value Dynamically In QWeb? - Odoo

Skip to Content

Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Accounting
  • Inventory
  • PoS
  • Project
  • MRP
All apps You need to be registered to interact with the community. All Posts People Badges Tags (View all) odoo accounting v14 pos v15 About this forum You need to be registered to interact with the community. All Posts People Badges Tags (View all) odoo accounting v14 pos v15 About this forum Help How to set colspan value dynamically in qWeb?

Get notified when there's activity on this post

Subscribe Following
This question has been flagged
qweb 1 Reply 16306 Views Avatar

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 Avatar Add a comment Discard Avatar

Try this

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

4 Avatar Add a comment Discard

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

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

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Sign up
Related Posts Replies Views Activity
Odoo 18: Display image from char field containing url in qweb form qweb Avatar Avatar 1 Jul 25 3277
PDF Export Option for QWeb Reports in odoo 17.0 qweb Avatar Avatar 1 May 25 4264
QWeb: use t-if to check birthday date Solved qweb Avatar Avatar 1 Apr 25 3480
Odoo 17 - QWeb Reports with External Datasource Solved qweb Avatar Avatar 1 Feb 25 2896
Tree line field shrinked/cut qweb Avatar 0 Oct 24 2346

Odoo Experience on YouTube

1. Use the live chat to ask your questions. 2. The operator answers within a few minutes.

Live support on Youtube Watch now

Từ khóa » Html Colspan Dynamic