Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
3 ตอบกลับ
13908 มุมมอง

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.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

thank you Niyas but how to resize image ?

อวตาร
ละทิ้ง

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

Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ส.ค. 24
2684
6
ก.ย. 22
28596
1
เม.ย. 19
3456
How to create Excel report in odoo9 ? แก้ไขแล้ว
7
เม.ย. 19
15328
2
พ.ค. 18
6090