콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
3 답글
13725 화면

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})

관련 게시물 답글 화면 활동
1
8월 24
2582
6
9월 22
28387
1
4월 19
3326
7
4월 19
15174
2
5월 18
5974