0
votes

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

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

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.

1

1 Answers

0
votes

I found the solution for another problem which shares the same solution as here.

These are the steps for a new user:

  1. Log in as administrator

  2. Employees > Employees > Create button (Fill the name)

  3. Select the "HR Settings" tab > Related User -> Create and edit (Fill the name and email).

  4. Save the user and save the employee.

  5. Go to Developer mode (User menu > About > Activate the developer mode)

  6. Settings > User > Select the new created user > Edit > Mark the option "Attendances"

  7. Save the user.

Now, the icon appears.