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.

0

How do I use custom images in custom CSS?

By
Alex Malone
on 4/22/13, 2:36 PM 1,029 views

Hi folks,

I am in the process of re-skinning version 7 for our CRM system. This involves a lot of custom CSS to override the existing colour system, but I also want to add some new images for use as backgrounds.

So, what I have in my __openerp__.py file:

    'images' : [
        'images/my_image.jpeg',
    ],
    'css': ['static/src/css/my.css'],

And then in my.css I have the following:

.openerp .oe_application .oe_form_sheetbg {
    background: url("images/my_image.jpeg") repeat scroll 0 0 transparent;
}

My question is what is the proper path to access my image? images/my_image.jpeg doesn't work and I've tried a few other variations too.

Many thanks in advance, and also a big thank you to the OpenERP team for allowing us to use custom CSS in the modules! It has always been a bit of a pain for us in the past as most of our customers want different skins on OpenERP and it became hard for us to source control each skin as we wanted the web client separate from client skins. This new system makes it soooo much easier!

0
Alex Malone
On 4/22/13, 3:21 PM

Right, sort of managed to solve the problem.

I have moved the image I want to use in to static/src/img directory. From there, I can reference it from the CSS in the following way:

.openerp .oe_application .oe_form_sheetbg {
    background: url("../my_image.jpg");
}

It seems that the images only work if placed within the static directory, as soon as you place them outside this directory the CSS is unable to find them. Also, listing the image within the images section of __openerp__.py seems to make absolutely no difference to the CSS. So, I'm a little confused but at least I have a working solution for now.

I suspect that the images section is probably used for setting icons on buttons/menu items etc.

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

0 follower(s)

Stats

Asked: 4/22/13, 2:36 PM
Seen: 1029 times
Last updated: 3/16/15, 8:10 AM