0% found this document useful (0 votes)
320 views7 pages

How To Set Qweb Report Table Height If Use T-Foreach Loop in Odoo12 Odoo

This document discusses how to set the height of a table when using a t-foreach loop in QWeb reports in Odoo 12. It provides an example from the hr_attendance module that sets the height and width of each table cell in the loop. It also includes sample code from the original poster that shows their heading row structure but is having issues with fixing the height when adding products in subsequent rows. Setting explicit heights on parent elements like <div> or the entire <table> does not resolve the issue.

Uploaded by

Mustapha Dell
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
320 views7 pages

How To Set Qweb Report Table Height If Use T-Foreach Loop in Odoo12 Odoo

This document discusses how to set the height of a table when using a t-foreach loop in QWeb reports in Odoo 12. It provides an example from the hr_attendance module that sets the height and width of each table cell in the loop. It also includes sample code from the original poster that shows their heading row structure but is having issues with fixing the height when adding products in subsequent rows. Setting explicit heights on parent elements like <div> or the entire <table> does not resolve the issue.

Uploaded by

Mustapha Dell
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 7

How to set qweb report table height if use "t-foreach" loop in odoo12 | Odoo https://www.odoo.

com/fr_FR/forum/aide-1/how-to-set-

Aide
Dismiss 

Odoo is the world's easiest all-in-one management software.


It includes hundreds of business apps:
CRM e-Commerce Comptabilité Inventaire PoS
Project management MRP

Take the tour

Aller à : Question 

Recherche… 

 0  

HILSHA votre adresse email... S'inscrire


27 mars 2020

1 sur 7
How to set qweb report table height if use "t-foreach" loop in odoo12 | Odoo https://www.odoo.com/fr_FR/forum/aide-1/how-to-set-

27 mars 2020

<table width="100%" border="0" style="height: 30%;border:1px


solid black;width:100%;">
i gave the table height and also tried with <div>

<div style="height:20mm;background-color:yellow;">

 Commenter  Partager

1 Commentaires

Sehrish - 18 août 2020 

Working with tables in QWEB�


https://learnopenerp.blogspot.com/2020/08/create-custom-
report-in-odoo-using-qweb.html

6 Réponses

 2 
 Niyas Raphy Meilleure réponse
27 mars 2020

Hi,
See this sample inside the existing odoo code, in hr_attendance
module, the template for printing the employee badge,

2 sur 7
How to set qweb report table height if use "t-foreach" loop in odoo12 | Odoo https://www.odoo.com/fr_FR/forum/aide-1/how-to-set-

<t t-foreach="docs" t-as="employee">


<div class="col-md-6">
<table style="width:243pt; height:153pt; border: 1pt
solid black; border-collapse:separate; border-radius:8pt;
margin:5pt">
<td style="width:33%;" valign="center">
<table style="width:77pt; height:150pt">
<tr style="height:30%">
<td align="center" valign="center">
<img
t-if="employee.company_id.logo" t-att-
src="image_data_uri(employee.company_id.logo)" style="max-
height:45pt;max-width:90%" alt="Company Logo"/>
</td>
</tr>
<tr style="height:70%;">
<td align="center" valign="center">
<img t-if="employee.image" t-att-
src="image_data_uri(employee.image)" style="max-height:85pt;
max-width:90%" alt="Employee Image"/>
</td>
</tr>
</table>
</td>
<td style="width:67%" valign="center">
<table style="width:155pt; height:85pt">
<tr><th><div style="font-size:15pt;
margin-bottom:0pt;margin-top:0pt;" align="center"><t
t-esc="employee.name"/></div></th></tr>
<tr><td><div align="center" style="font-
size:10pt;margin-bottom:5pt;"><t
t-esc="employee.job_id.name"/></div></td></tr>
<tr><td><img alt="barcode"

3 sur 7
How to set qweb report table height if use "t-foreach" loop in odoo12 | Odoo https://www.odoo.com/fr_FR/forum/aide-1/how-to-set-

<tr><td><img alt="barcode"
t-if="employee.barcode" t-att-src="'/report/barcode/?type=%s&
amp;value=%s&amp;width=%s&amp;height=%s' % ('Code128',
employee.barcode, 600, 120)" style="max-height:50pt;max-
width:100%;" align="center"/></td></tr>
</table>
</td>
</table>
</div>
</t>

Thanks

 Commentaires  Partager

2 Commentaires

HILSHA - 27 mars 2020 

its all looks exactly like the old one,


The first raw of my table is the heading.2 nd row product with
invoices will all added up ,what to do to fix the height when
adding the products with the for loop

HILSHA - 27 mars 2020 

sample code
<table width="100%" border="0" style="height:153mm;
border:1px solid black;width:100%;">
<tr style="font-family:Times New Roman;border:1px solid
black;padding: 3px;" width="100%">

4 sur 7
How to set qweb report table height if use "t-foreach" loop in odoo12 | Odoo https://www.odoo.com/fr_FR/forum/aide-1/how-to-set-

black;padding: 3px;" width="100%">

<td width="4%" align="center" style="font-family:Times New


Roman;border:1px solid black;padding: 3px;">

<b>S No</b>

</td>
<td valign="middle" width="39%" align="center" style="font-
family:Times New Roman;border:1px solid black;padding: 3px;">
<div>
<div>

<span style="padding-top:12px;padding-left:10px;float:
left;font-family:Times New Roman;font-size:11px;">
<b> Description</b>
</span>

<span style="padding-top:12px;padding-left:10px;float:
right;font-family:Times New Roman;font-size:11px;">
<b>. </b>

</span>
<div style="clear:both;"></div>
</div>
</div>
</td>

</tr>
<tr t-foreach="o.invoice_line_ids" t-as="l" style="font-
family:Times New Roman;border:1px solid black;padding:

5 sur 7
How to set qweb report table height if use "t-foreach" loop in odoo12 | Odoo https://www.odoo.com/fr_FR/forum/aide-1/how-to-set-

family:Times New Roman;border:1px solid black;padding:


8px;padding-top:8px;">
<td height="20" align="center" style="font-family:Times New
Roman;border:1px solid black;padding: 3px;">

<b>
<t t-esc="l_index+1"/>

</b>
</td>
<td align="left" style="font-family:Times New Roman;border:1px
solid black;padding: 3px;">
<b>

<t t-esc="l.product_id.name"/>
</b>
</td>
</tr>
</table>

 4 
MUHAMMAD Imran
27 mars 2020

it works with <table style="height:150mm;"> but not with <table


class="table table-condensed table-hover border"
style="height:150mm;">

 Commentaires  Partager

6 sur 7
How to set qweb report table height if use "t-foreach" loop in odoo12 | Odoo https://www.odoo.com/fr_FR/forum/aide-1/how-to-set-

 Commentaires  Partager

1 Commentaires

HILSHA - 27 mars 2020 

I have not given the class to that table

Website made with

7 sur 7

You might also like