Hello all,
I found the way to save an image at my DB using fields.Binary().
Now, I need to get that image on my QWeb report..
Do you know how to call that field from the Qweb report?
Thanks in advance!
Regards
Alejandro
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hello all,
I found the way to save an image at my DB using fields.Binary().
Now, I need to get that image on my QWeb report..
Do you know how to call that field from the Qweb report?
Thanks in advance!
Regards
Alejandro
@Luke, I found a response from you for a similar question (\source)
Now I'm printing the image in the QWeb report this way:
<span t-field="product_id.image_small" t-field-options="{"widget": "image", "class": "img-rounded"}"/>
Thank you!
@Alejandro, no problem, i'm glad it helped.
Look at this...
in report_purchasequotation_document, I can get image with code :
<h2>Request for quotation : N° <span t-field="o.name"/></h2>
<table class="table table-condensed">
<thead>
<tr>
<th class="text-left"><strong> Picture</strong></th>
<th class="text-left"><strong>Description</strong></th>
<th class="text-center"><strong>Expected date</strong></th>
<th class="text-right"><strong>Quantity</strong></th>
</tr>
</thead>
<tbody>
<tr t-foreach="o.order_line" t-as="order_line">
<td>
<span t-field="order_line.product_id.image_small" t-field-options="{"widget": "image", "class": "img-rounded"}"/>
</td>
<td>
<span t-field="order_line.name"/>
</td>
<td class="text-center">
<p t-field="order_line.date_planned" t-field-options='{"format": "d MMMM y"}'/>
</td>
<td class="text-right">
<span t-field="order_line.product_qty"/>
<span t-field="order_line.product_uom" groups="product.group_uom"/>
</td>
</tr>
</tbody>
</table>
In report_saleorder_document, I can NOT get image with code :
<table class="table table-condensed">
<thead>
<tr>
<th> Picture</th>
<th>Description</th>
<th>Taxes</th>
<th class="text-right">Quantity</th>
<th class="text-right">Unit price</th>
<th groups="sale.group_discount_per_so_line">Disc.(%)</th>
<th class="text-right">Price</th>
</tr>
</thead>
<tbody class="sale_tbody">
<tr t-foreach="o.order_line" t-as="l">
<td>
<span t-field="l.product_id.image_small" t-field-options="{"widget": "image", "class": "img-rounded"}"/>
</td>
<td><span t-field="l.name"/>
</td>
<td>
<span t-esc="', '.join(map(lambda x: x.name, l.tax_id))"/>
</td>
<td class="text-right">
<span t-field="l.product_uom_qty"/>
<span groups="product.group_uom" t-field="l.product_uom"/>
</td>
<td class="text-right">
<span t-field="l.price_unit"/>
</td>
<td groups="sale.group_discount_per_so_line">
<span t-field="l.discount"/>
</td>
<td class="text-right">
<span t-field="l.price_subtotal" t-field-options="{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}"/>
</td>
</tr>
</tbody>
</table>
Do you see the problem guy?
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
1
May 15
|
12996 | ||
|
4
Nov 24
|
5233 | ||
|
1
Mar 24
|
394 | ||
|
3
Sep 23
|
22643 | ||
|
0
Feb 24
|
1716 |
+1 for this post. I will follow it.
A real use-case could be "how to print the field product_template.image on a QWeb report" since that field is a binary type.
@Alejandro, are you storing the image in a one2many relationship (eg. order lines), or is this just a single field that you would like to include on a report? Please let me know what report you are working on and how you would like to display the field (eg. a t-foreach t-as type loop - eg. order lines). I've already built a theme module that includes heavy modification of the default quotation, sales order, invoice, etc. reports. I'll be separating this into a standalone module here: https://github.com/OdooCommunityWidgets/product_extended_report_order_lines over the next few days if that is any help.
Hello @Luke, I'm working with a single binary field 'product_template.image'. I would like to include that image on a QWeb report. Thank you for your interest!