Hello,
I want to display image of the product of sale order line in excel report using xlwt/python.
But not able to find the way. So anybody has solution then please help me.
Thanks in advance for your help!!!
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hello,
I want to display image of the product of sale order line in excel report using xlwt/python.
But not able to find the way. So anybody has solution then please help me.
Thanks in advance for your help!!!
Hi,
To use an image in xlwt report odoo, you have to save that image in a location first, then plot it in xls report using the xlwt functions. But in xlsxwriter this is different, you can use the image buffer directly.
eg:
company_id = request.env.user.company_id
binaryData = company_id.logo
data = base64.b64decode(binaryData)
# create a temporary file, and save the image
fobj = tempfile.NamedTemporaryFile(delete=False)
fname = fobj.name
fobj.write(data)
fobj.close()
# open the image with PIL
try:
im = Image.open(fname)
# do stuff here
finally:
# delete the file when done
os.unlink(fname)
# im = BytesIO(data)
# im = Image.frombuffer('RGBA', [1080, 1920] , binaryData, "raw", 'RGBA', 0, 1)
image_parts = im.split()
r = image_parts[0]
g = image_parts[1]
b = image_parts[2]
img = Image.merge("RGB", (r, g, b))
fo = BytesIO()
img.save(fo, format='bmp')
worksheet.insert_bitmap_data(fo.getvalue(), 0, 0)
Here I took the company logo to print in xls, change the image file accordingly.
Nice Solution hilar
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
0
Mar 22
|
5004 | ||
|
2
Aug 22
|
4583 | ||
|
0
Mar 17
|
2546 | ||
|
3
Nov 17
|
21975 | ||
|
1
Mar 15
|
4206 |
@Anand Patel, i'm also looking for a solution. I think this can be accomplished with Aeroo, Jasper, or other reporting systems that have modules ported to 8.0, however I have not managed to get any of these solutions working in 8.0 at this point in time. I'll post back if I have more information.
--
Anand Patel
+91 9601663735