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 to put a menu Icon in odoo 9?

By
MouTio
on 8/22/16, 6:16 AM 440 views

I want to put a menu icon for the hr_attendance addon.

I will explain the steps that i have done:

1. Create hr_attendance_extend an put it in addon_extra

2. Import the original addon. This is "__init__.py:

import hr_attendance


3. Create the css and put the icon. This is a piece of the file "static/src/css/slider.css":

...

.oe_systray .oe_attendance_signout {

float:right;

height: 32px;

width: 32px;

background: url(/hr_attendance_extend/static/src/img/emp-in32.png);

cursor: pointer;

}

...


4. Link the file with the addon. This is the file ''views/hr_attendance.xml":

<?xml version="1.0" encoding="utf-8"?>

<openerp>

<data>

<template id="assets_backend" name="hr_attendance assets" inherit_id="web.assets_backend">

<xpath expr="." position="inside">

  <link rel="stylesheet" href="/hr_attendance_extend/static/src/css/slider.css"/>

</xpath>

</template>

</data>

</openerp>


5. Put the new files in the new addon. This is part of the file "__openerp__.py":

{

...

'depends': ['hr_attendance'],

'data': [

'hr_attendance.xml',

'views/hr_attendance.xml',

],

'demo': [],

'test': [],

'installable': True,

'auto_install': False,

#web 

'qweb' : ["static/src/xml/attendance.xml"],

}


6. Put the container for the menu. This is the file ''static/src/xml/attendance.xml":

<template>

<t t-name="AttendanceSlider">

<li class="oe_attendance_status oe_attendance_nosigned" data-toggle="tooltip">

  <div class="oe_attendance_signout"></div>

</li>

</t>

</template>


In the original addon (hr_attendance) there is a function that it pushes the icon to the menu (I think). 

There is in the file static/src/js/attendance.js and that is the line in question:

SystrayMenu.Items.push(AttendanceSlider);

That's all.

I don't know if I am missing something.  The code of the icon appears in the html, but there is with 'style="display: none"'

0
MouTio
On 8/24/16, 4:22 AM

Giezel Esteves, thanks for the interest, but that doesn't fix anything.

I have an icon.png in the folder.


Nevertheless, I realized what was wrong.

The problem is that my current user is not an employee, and that's the reason of the "style=display: none;"
I assigned an employee to the user and now the icon appears.

0
Giezel Esteves
On 8/23/16, 9:35 PM

just add your icon.png inside your description folder

module_name/static/description/icon.png

restart odoo-server

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: 8/22/16, 6:16 AM
Seen: 440 times
Last updated: 8/25/16, 4:46 AM