Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
I would like to add an image to a xml file.
This image is stored on the database (like res_partner.image).
How is possible to print this image on a xml file?
It will be nice to have this image with a sql request (cr.execute) and convert it in binary or in picture in order to have the possibility to print it.
Thank you a lot
It is, and you can find examples in the standard modules. The trick is to convert the image to base64. Yiou can find a tool, do it with a small Python script, or even use a website service for that (there are several on the web).
For an example have a look at
Hi wowas, OpenERP Vietnam,
Thank you, really, for your help. I will be more precise about my problem: I use the code below:
cr.execute('SELECT res_company.logo_web FROM res_company') res = cr.fetchall() v['logo_Print'] = res
I would to put in the field logo_Print, the picture that is stored in the table: res_company, field logo_web, id = one. I think that maybe there is an fonction to translate bytea image (field in database) into binary in my python code, no?
[Edit] Now, i try with :
cr.execute('SELECT res_company.logo_web FROM res_company') res = cr.fetchall() v['logoTmp'] = base64.decodestring(str(res))
But still doesn't work, any idea please? How is possible to convert an "tuple" into a string? Or maybe, need i to get the picture differently?
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
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.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 8/24/13, 3:33 PM|
|Seen: 5675 times|
|Last updated: 3/16/15, 8:10 AM|