Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
6 Risposte
12411 Visualizzazioni
<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;">
Avatar
Abbandona
Risposta migliore

Hi,

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


<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" 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

Avatar
Abbandona
Autore

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

Autore

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%">

<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: 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>

Risposta migliore

it works with <table style="height:150mm;"> but not with <table class="table table-condensed table-hover border" style="height:150mm;">

Avatar
Abbandona
Autore

I have not given the class to that table