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"'