Odoo Help


How to add product image from xmlrpc call

on 8/1/13, 9:31 AM 3,201 views


I want insert image in product using xmlrpc, so how to pass data in php call to insert product image?? i have try to pass data like in point_of_sale_data.xml but it give me error cannot identify image file

Thanks jagdish

Alain Ivars
On 8/1/13, 12:22 PM
  • rename the image files according to your products (<product-code>.jpg or <id>.jpg)
  • Write a short python script which loops over the image files, encode with base64 and write to OpenERP with XMLRPC

# get file
yourImage = request.files.get('product1.jpg')
# read it
image = yourImage.file.read()
# encode it base64
imageBase64 = base64.b64encode(image)
# now pass it to your XMLRPC call

I hope that will help you :)

Thank Alain, for great answer. Can you please tell how to read image from xml rpc. I have created custom module in openerp v7 and I want to fetch value of that module in my website using django. I am able to fetch all text field, but not able to get image. While fetching image (binary field) it gives value probably b64encoded. I don't know to make that image visible without storing image data. Is there any direct way to access image url of openerp module. Can you please guide me ? Thanks for your time and help.

Virtual Reality Systems, Vimal Rughani
on 3/18/14, 2:49 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 8/1/13, 9:31 AM
Seen: 3201 times
Last updated: 3/16/15, 8:10 AM