Ir al contenido
Menú
Se marcó esta pregunta
3 Respuestas
735 Vistas

I'm encountering an issue with a customized PDF quotation.

I've added a product image column (image_1980). When a product is created manually and the image is uploaded directly, it displays correctly on the quotation.

However, if the products were created using Odoo's import tool, the images do not appear in the quotation, even though they are visible on the product page and on the website.

Has anyone experienced a similar issue?

I've attached a screenshot to help illustrate the problem.

Thanks in advance for your help!


Avatar
Descartar
Autor Mejor respuesta

I just noticed that it works through the import tool if the images are uploaded in JPG or PNG format.

However, if I convert them to WebP beforehand, Odoo cannot display them in the PDF report.

When I manually import them as JPG, they are converted to WebP, and in that case, pdf reportis able to read them.
What a mess !

Here is the relevant line from my QWEB report:

<span t-field="line.product_id.image_1920" t-options-widget="'image'" t-options-qweb_img_raw_data="1" t-options-width="'250px'"/>

Avatar
Descartar
Mejor respuesta

Hey! Here's what you should check first:

Take a look at your PDF template code: Make sure you're calling the right field name (image_1980). If that's correct, try updating your image code to this:

<img t-att-src="'data:image/png;base64,%s' % product.image_1980.decode('utf-8')" t-if="product.image_1980"/>

Double-check how you imported the images: The thing is, when you import products, the images need to be in a specific format (base64-encoded strings). Sometimes the import doesn't format them the same way as when you upload manually.

Here's an easy way to check: Turn on Developer Mode and compare a working product (manually uploaded) with a non-working one (imported). Look at the image_1980 field values - they should look identical.

If they're different, you'll need to re-import your products with the images in the correct format. You can export a working product first to see exactly how the image data should look.

also check the image type, as you see the code it mentions png format,so try to upload png format images.

I hope it works.

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
5
oct 25
7903
5
ene 24
60744
0
ene 17
3938
1
mar 21
2343
1
mar 19
5405