Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
2897 Vistas

hello,
i'm trying to but all records  in one table, but instead each record will be printed as separate table. how could i have all records in one table instead table for each record.
Thanks for your help  

Avatar
Descartar

Hi Abdulkader,
Perhaps you are looping over the table instead of <tr> tag.

Autor

hello Kalkivi
this is the code that i wrote.
<template id="report_price_posters">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="product_tmpl_id">

<style>
.head {
background-color : #2d3436 ;
color :black;
}
.inside_cell {
background-color : #2980b9;
color: white;
}
.description {
text-align: left;
}
</style>
<table class="table">
<thead class="head">
<tr>
<th>Product Name</th>
<th>Description</th>
<th>Quantity</th>
<th>Price €</th>
</tr>

</thead>
<tbody>
<t t-foreach="product_tmpl_id" t-as="product_line_id">
<tr class="inside_cell">
<td t-esc="product_line_id.name"/>
<td t-esc="product_line_id.description"/>
<td t-esc="product_line_id.quantity"/>
<td t-esc="product_line_id.list_price"/>
</tr>
<tr>
<td style="height:100;width:100;">
<img t-att-src="image_data_uri(product_tmpl_id.image_1920)" hight="200"
width="200"/>
</td>
<td class="description">
<t t-esc="product_line_id.description_2"/>
</td>
<td>
</td>
<td>
</td>
</tr>
</t>
</tbody>
</table>
</t>
</t>
</template>

Can try with the below snippet?

<template id="report_price_posters">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="product_tmpl_id">
<t t-call="web.external_layout">
<div class="page">
<style>
.head {
background-color : #2d3436 ;
color :black;
}
.inside_cell {
background-color : #2980b9;
color: white;
}
.description {
text-align: left;
}
</style>
<div class="row">
<div class="col-12">
<table class="table table-bordered">
<thead style="display: table-row-group">
<tr>
<th class="text-center" style="width: 25%" scope="col">Product Name</th>
<th class="text-center" style="width: 25%" scope="col">Description</th>
<th class="text-center" style="width: 25%" scope="col">Quantity</th>
<th class="text-center" style="width: 25%" scope="col">Price €</th>
</tr>
</thead>
<tbody>
<t t-foreach="product_tmpl_id" t-as="product_line_id">
<tr class="inside_cell">
<td t-esc="product_line_id.name"/>
<td t-esc="product_line_id.description"/>
<td t-esc="product_line_id.quantity"/>
<td t-esc="product_line_id.list_price"/>
</tr>
<tr>
<td>
<img t-att-src="image_data_uri(product_tmpl_id.image_1920)" hight="200"
width="200"/>
</td>
<td class="description">
<t t-esc="product_line_id.description_2"/>
</td>
<td>
</td>
<td>
</td>
</tr>
</t>
</tbody>
</table>
</div>
</div>
</t>
</div>
</t>
</t>
</t>
</template>

Autor

i think this code will print the each record in a new
table in separate page and i want them in one page.

Autor

thank u anyway Kalkivi

Autor Mejor respuesta

hello Kalkivi.
FYI i solved the proplem and i wanted to share the result with u
the proplem was i had two Loops in the code which shouldn't be.
the functional code is :
<template id="report_price_posters">
<t t-call="web.html_container">
<t t-set="product_tmpl_id" t-value="docs"/>
<div class="">
<style>
.head {
background-color : #2d3436 ;
color :white;
}
.inside_cell {
background-color : #2980b9;
color: white;
}
.description {
text-align: left;
}
</style>
<div class="row">
<div class="col-12">
<table class="table table-bordered">
<t>
<tr class="head">
<th class="text-center" style="width: 25%" scope="col">Product Name</th>
<th class="text-center" style="width: 25%" scope="col">Description</th>
<th class="text-center" style="width: 25%" scope="col">Quantity</th>
<th class="text-center" style="width: 25%" scope="col">Price €</th>
</tr>
</t>
<tbody>
<t t-foreach="product_tmpl_id" t-as="product_line_id">
<tr class="inside_cell">
<td t-esc="product_line_id.name"/>
<td t-esc="product_line_id.description"/>
<td t-esc="product_line_id.quantity"/>
<td t-esc="product_line_id.list_price"/>
</tr>
<tr>
<td>
<img t-att-src="image_data_uri(product_line_id.image_1920)"
hight="200"
width="200"/>
</td>
<td class="description">
<t t-esc="product_line_id.description_2"/>
</td>
<td>
</td>
<td>
</td>
</tr>
</t>
</tbody>
</table>
</div>
</div>
</div>
</t>
</template>
and i want to thank u for taking some of your time trying to help me :D

Avatar
Descartar

Thank you for letting me know

Publicaciones relacionadas Respuestas Vistas Actividad
4
ene 25
44533
0
oct 24
1445
0
oct 24
5
2
jul 23
6249
1
jun 23
4276