Odoo Help

Welcome!

This community 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.

1

Use custom images in a module

By
ruben.theys@leanit.be
on 11/24/14, 6:19 AM 1,156 views

In a module I'm creating, I want to use a custom image as a button. I do not know where to save the image, and how to reference it from the view's xml...

The image looks like this, and will be used to fetch a weight from a scale into a field.

http://i58.tinypic.com/2rw2ueh.png

I've read about solutions with saving the image in /addons/web/static/src/....... path, but this kind of breaks the portability of the module. I want to save the image in a subfolder of my addon's folder, so it just comes preinstalled with the module.

What folder should I use, and how can I access the file from a view afterwards?

0
Juan José Scarafía
On 11/25/14, 9:30 AM

Hi Ruben,

You have to create a folder named "static". Inside you have to create another folder named "description". Inside this folder, you have to save all the images you are going to use in the module. The file _openerp_.py is the one where you have to create the description and add the images, all in HTML format. To put an icon, you have to save the image as "icon.png".

Regards,

Juan José - Ing ADHOC

0

Ivan

--Ivan--
3210
| 5 3 6
Jakarta, Indonesia
--Ivan--
Ivan
On 11/26/14, 6:42 AM

AFAIK the list of icons to be used for buttons are limited to those stored in odoo/addons/web/static/src/img/icons.  See odoo/odoo/addons/web/static/src/xml/base.xml lines 1145 and 807 (for v7).  In v8 they added images from fontawesome TTF for WidgetButton.

Your Answer

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 community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 11/24/14, 6:19 AM
Seen: 1156 times
Last updated: 3/16/15, 8:10 AM