Skip to Content
Menu
This question has been flagged
1 Reply
5621 Views

Hello,


I want to display the image of my articles on my labels.

In this file "addons/product/report/product_product_templates.xml" we found how the fields are print, like product name:

<tr style="width: 3in;">
                    <td style="border: 2px solid black;width: 2.63in;" colspan="2" class="col-xs-8 danger">
                        <t t-if="product.default_code">
                            [<strong t-field="product.default_code"/>]
                        </t>
                        <strong t-field="product.name"/>
                    </td>
                </tr>

  barcode...

<td style="border: 2px solid black;text-align: center; vertical-align: middle;" class="col-xs-5">
                        <img t-if="product.barcode" t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('EAN13', product.barcode, 600, 150)" style="width:100%;height:20%;"/>
                        <span t-field="product.barcode"/>
                    </td>


I want to add the product image, (stores in base64 from jpg in my database) Can I add them by this file, and how?

Thank you.

Avatar
Discard
Author Best Answer

I finnaly find it, in the forum (https://www.odoo.com/fr_FR/forum/aide-1/question/qweb-report-can-t-access-company-fields-110911)

<img t-if="product.image_medium" t-att-src="'data:image/jpg;base64,%s' % (product.image_medium,)" style="max-height:45pt;max-width:90%"/>
Avatar
Discard
Related Posts Replies Views Activity
2
Jun 24
6255
0
Feb 24
458
1
May 20
2254
0
Mar 20
1964
3
Dec 19
4772