I want to put a menu icon for the hr_attendance addon in odoo 9.
I will explain the steps that i have done:
Create hr_attendance_extend an put it in addon_extra
Import the original addon. This is "init.py":
import hr_attendance
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; } ...
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>
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"], }
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"'
Edit: If I change the css file putting the property "display: block !important", then, the icon appears in the menu, but that fix is not the correct solution.