Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
3 Odpowiedzi
13184 Widoki

Hello Folks,


I have been creating an excel report, and want to use product images into the same report. I have used the code: worksheet.insert_image(stat_row+1, 0, order_line.product_id.image_small, {'x_scale': 0.9, 'y_scale': 0.6}) to insert the image into excel sheet created. But it fails to insert the image.


Can anyone helps me to know the same? I have many order lines for my sales orders and want images for all the products.


Many thanks in advance.

Awatar
Odrzuć
Najlepsza odpowiedź

Hi,

You can add the images to excel report like this,

if product.image_medium:
product_image = io.BytesIO(base64.b64decode(product.image_medium))
sheet.insert_image(row, col, "image.png", {'image_data': product_image})

Thanks

Awatar
Odrzuć
Najlepsza odpowiedź

Checkout our module which is available on Odoo Apps with Version 14, 15 and 16.

Search on Odoo apps Module name: Add Image in Excel / xls report

Awatar
Odrzuć
Najlepsza odpowiedź

thank you Niyas but how to resize image ?

Awatar
Odrzuć

sheet.insert_image('B1', product_image, {'x_scale': 0.6, 'y_scale': 0.8})

Powiązane posty Odpowiedzi Widoki Czynność
1
sie 24
2208
6
wrz 22
27846
1
kwi 19
2933
7
kwi 19
14769
2
maj 18
5704