Browse Source

[ADD] Initial Commit

pull/45/head
SHEREEF PT 8 years ago
parent
commit
456987f60d
  1. 24
      employee_stages/__init__.py
  2. 45
      employee_stages/__manifest__.py
  3. 24
      employee_stages/models/__init__.py
  4. 148
      employee_stages/models/employee_stages.py
  5. 7
      employee_stages/security/ir.model.access.csv
  6. BIN
      employee_stages/static/description/banner.jpg
  7. BIN
      employee_stages/static/description/cybro_logo.png
  8. BIN
      employee_stages/static/description/filter.png
  9. BIN
      employee_stages/static/description/groupby.png
  10. BIN
      employee_stages/static/description/icon.png
  11. 175
      employee_stages/static/description/index.html
  12. BIN
      employee_stages/static/description/kanban.png
  13. BIN
      employee_stages/static/description/status1.png
  14. BIN
      employee_stages/static/description/status2.png
  15. BIN
      employee_stages/static/description/status3.png
  16. BIN
      employee_stages/static/description/status5.png
  17. BIN
      employee_stages/static/description/status6.png
  18. BIN
      employee_stages/static/description/tree.png
  19. 120
      employee_stages/views/employee_stages_view.xml

24
employee_stages/__init__.py

@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Jesni Banu(jesni@cybrosys.in)
# you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# It is forbidden to publish, distribute, sublicense, or sell copies
# of the Software or modified copies of the Software.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import models

45
employee_stages/__manifest__.py

@ -0,0 +1,45 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Jesni Banu(jesni@cybrosys.in)
# you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# It is forbidden to publish, distribute, sublicense, or sell copies
# of the Software or modified copies of the Software.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'name': 'Employee Stages',
'version': '10.0.1.0.0',
'summary': """Manages Employee Stages""",
'description': """This module is used to tracking the employee's different stages.""",
'category': "Generic Modules/Human Resources",
'author': 'Cybrosys Techno Solutions',
'company': 'Cybrosys Techno Solutions',
'website': "https://www.cybrosys.com",
'depends': ['base', 'hr'],
'data': [
'security/ir.model.access.csv',
'views/employee_stages_view.xml',
],
'demo': [],
'images': ['static/description/banner.jpg'],
'license': 'LGPL-3',
'installable': True,
'auto_install': False,
'application': False,
}

24
employee_stages/models/__init__.py

@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Jesni Banu(jesni@cybrosys.in)
# you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# It is forbidden to publish, distribute, sublicense, or sell copies
# of the Software or modified copies of the Software.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import employee_stages

148
employee_stages/models/employee_stages.py

@ -0,0 +1,148 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Jesni Banu(jesni@cybrosys.in)
# you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# It is forbidden to publish, distribute, sublicense, or sell copies
# of the Software or modified copies of the Software.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from datetime import date
from odoo import models, fields, api
emp_stages = [('joined', 'Slap On'),
('grounding', 'Grounding'),
('test_period', 'Test Period'),
('employment', 'Employment'),
('notice_period', 'Notice Period'),
('relieved', 'Resigned'),
('terminate', 'Terminated')]
class EmployeeFormInherit(models.Model):
_inherit = 'hr.employee'
@api.model
def create(self, vals):
result = super(EmployeeFormInherit, self).create(vals)
result.stages_history.sudo().create({'start_date': date.today(),
'employee_id': result.id,
'state': 'joined'})
return result
@api.multi
def start_grounding(self):
self.state = 'grounding'
self.stages_history.sudo().create({'start_date': date.today(),
'employee_id': self.id,
'state': 'grounding'})
@api.multi
def set_as_employee(self):
self.state = 'employment'
stage_obj = self.stages_history.search([('employee_id', '=', self.id),
('state', '=', 'test_period')])
if stage_obj:
stage_obj.sudo().write({'end_date': date.today()})
self.stages_history.sudo().create({'start_date': date.today(),
'employee_id': self.id,
'state': 'employment'})
@api.multi
def start_notice_period(self):
self.state = 'notice_period'
stage_obj = self.stages_history.search([('employee_id', '=', self.id),
('state', '=', 'employment')])
if stage_obj:
stage_obj.sudo().write({'end_date': date.today()})
self.stages_history.sudo().create({'start_date': date.today(),
'employee_id': self.id,
'state': 'notice_period'})
@api.multi
def relived(self):
self.state = 'relieved'
self.active = False
stage_obj = self.stages_history.search([('employee_id', '=', self.id),
('state', '=', 'notice_period')])
if stage_obj:
stage_obj.sudo().write({'end_date': date.today()})
self.stages_history.sudo().create({'end_date': date.today(),
'employee_id': self.id,
'state': 'relieved'})
@api.multi
def start_test_period(self):
self.state = 'test_period'
self.stages_history.search([('employee_id', '=', self.id),
('state', '=', 'grounding')]).sudo().write({'end_date': date.today()})
self.stages_history.sudo().create({'start_date': date.today(),
'employee_id': self.id,
'state': 'test_period'})
@api.multi
def terminate(self):
self.state = 'terminate'
self.active = False
stage_obj = self.stages_history.search([('employee_id', '=', self.id),
('state', '=', 'employment')])
if stage_obj:
stage_obj.sudo().write({'end_date': date.today()})
else:
self.stages_history.search([('employee_id', '=', self.id),
('state', '=', 'grounding')]).sudo().write({'end_date': date.today()})
self.stages_history.sudo().create({'end_date': date.today(),
'employee_id': self.id,
'state': 'terminate'})
state = fields.Selection(emp_stages, string='Status', default='joined', track_visibility='always', copy=False,
help="Employee Stages.\nSlap On: Joined\nGrounding: Training\nTest period : Probation")
stages_history = fields.One2many('hr.employee.status.history', 'employee_id', string='Stage History',
help='It shows the duration and history of each stages')
class EmployeeStageHistory(models.Model):
_name = 'hr.employee.status.history'
_description = 'Status History'
@api.depends('end_date')
def get_duration(self):
for each in self:
if each.end_date and each.start_date:
duration = fields.Date.from_string(each.end_date) - fields.Date.from_string(each.start_date)
each.duration = duration.days
start_date = fields.Date(string='Start Date')
end_date = fields.Date(string='End Date')
duration = fields.Integer(compute=get_duration, string='Duration(days)')
state = fields.Selection(emp_stages, string='Stage')
employee_id = fields.Many2one('hr.employee', invisible=1)
class WizardEmployee(models.TransientModel):
_name = 'wizard.employee.stage'
@api.multi
def set_as_employee(self):
context = self._context
employee_obj = self.env['hr.employee'].search([('id', '=', context.get('employee_id'))])
if self.related_user:
employee_obj.user_id = self.related_user
employee_obj.set_as_employee()
related_user = fields.Many2one('res.users', string="Related User")

7
employee_stages/security/ir.model.access.csv

@ -0,0 +1,7 @@
id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink
access_wizard_employee_stage_manager,wizard.employee.stage.manager,model_wizard_employee_stage,hr.group_hr_manager,1,1,1,1
access_wizard_employee_stage_hr_user,wizard.employee.stage.user,model_wizard_employee_stage,hr.group_hr_user,1,1,1,0
access_hr_employee_status_history_manager,hr.employee.status.history.manager,model_hr_employee_status_history,hr.group_hr_manager,1,1,1,1
access_hr_employee_status_history_hr_user,hr.employee.status.history.user,model_hr_employee_status_history,hr.group_hr_user,1,1,1,0
1 id name model_id/id group_id/id perm_read perm_write perm_create perm_unlink
2 access_wizard_employee_stage_manager wizard.employee.stage.manager model_wizard_employee_stage hr.group_hr_manager 1 1 1 1
3 access_wizard_employee_stage_hr_user wizard.employee.stage.user model_wizard_employee_stage hr.group_hr_user 1 1 1 0
4 access_hr_employee_status_history_manager hr.employee.status.history.manager model_hr_employee_status_history hr.group_hr_manager 1 1 1 1
5 access_hr_employee_status_history_hr_user hr.employee.status.history.user model_hr_employee_status_history hr.group_hr_user 1 1 1 0

BIN
employee_stages/static/description/banner.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

BIN
employee_stages/static/description/cybro_logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
employee_stages/static/description/filter.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
employee_stages/static/description/groupby.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

BIN
employee_stages/static/description/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

175
employee_stages/static/description/index.html

@ -0,0 +1,175 @@
<section class="oe_container">
<div class="oe_row oe_spaced">
<h2 class="oe_slogan">Employee Stages</h2>
<h3 class="oe_slogan">Manages Employee Stages</h3>
<h4 class="oe_slogan"><a href="https://www.cybrosys.com">Cybrosys Technologies</a> </h4>
</div>
<div class="oe_row oe_spaced" style="padding-left:65px;">
<h4>Features:</h4>
<div>
<span style="color:green;"> &#9745; </span> Managing employee's different stages.<br/>
<span style="color:green;"> &#9745; </span> Added employee's current stage in tree view.<br/>
<span style="color:green;"> &#9745; </span> Added employee's current stage in kanban view.<br/>
<span style="color:green;"> &#9745; </span> Added group by stage in search view.<br/>
<span style="color:green;"> &#9745; </span> Added Employee filter in search view.<br/>
<span style="color:green;"> &#9745; </span> Added default search for employees in search bar.<br/>
<span style="color:green;"> &#9745; </span> Automatically recording the stage history.<br/>
<span style="color:green;"> &#9745; </span> Computing the duration of each stage.<br/>
<span style="color:green;"> &#9745; </span> Option to set 'Related User' while converting to the employee.<br/>
<span style="color:green;"> &#9745; </span> Automatically inactive the employee while terminating or relieving the employee.<br/>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div class="oe_picture">
<h3 class="oe_slogan">Overview</h3>
<p class="oe_mt32 text-justify" style="text-align: center;">
Every employee may undergo different stages during his term in a company.
It may be probation, training, employment etc. The stages may vary according to the organisation.
It is important to track such stages systematically to assess the performance indices of
an employee. So here we are providing
a new module which will facilitate the management of different stages of an employee.
</p>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<div style="text-align: center">
<p>
<h4>Employee Stages</h4>
<p>
</div>
<div style="text-align: center">
<span class="oe_mt32 text-justify" style="text-align: center;">Here we can see different stages of employee, buttons to change the stages and overall history.</span>
<div class="oe_demo oe_picture oe_screenshot">
<img style="border:10px solid white;" src="status1.png">
</div>
</div>
<div style="text-align: center">
<div class="oe_demo oe_picture oe_screenshot">
<img style="border:10px solid white;" src="status3.png">
</div>
<span class="oe_mt32 text-justify" style="text-align: center;">Status History tab tracking the Start date, End date and Duration of each stages.</span>
</div>
<div style="text-align: center">
<div class="oe_demo oe_picture oe_screenshot">
<img style="border:10px solid white;height: 400px;" src="status5.png">
</div>
<span class="oe_mt32 text-justify" style="text-align: center;">When an employee's state is reached to 'Resigned' stage then the system will automatically
inactive this employee</span>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div style="text-align: center">
<p>
<h4>Option to Add Related User</h4>
</p>
</div>
<div class="" style="text-align: center">
<div class="oe_demo oe_picture oe_screenshot">
<img style="border:10px solid white;" src="status2.png">
</div>
<span class="oe_mt32 text-justify" style="text-align: center;">We have an option to add 'Related User' when we set to 'Employment' stage.</span>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<div style="text-align: center">
<p>
<h4>Kanban View</h4>
</p>
</div>
<div class="" style="text-align: center">
<div class="oe_demo oe_picture oe_screenshot">
<img style="border:10px solid white;height: 400px;" src="kanban.png">
</div>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div style="text-align: center">
<p>
<h4>Tree View</h4>
</p>
</div>
<div class="" style="text-align: center">
<div class="oe_demo oe_picture oe_screenshot">
<img style="border:10px solid white;" src="tree.png">
</div>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<div style="text-align: center">
<p>
<h4>Search Bar</h4>
</p>
</div>
<div class="" style="text-align: center">
<div class="oe_demo oe_picture oe_screenshot">
<img style="border:10px solid white;height: 400px;" src="status6.png">
</div>
<span>In employees view we shows only the users which are in 'Employment' stage.</span>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div style="text-align: center">
<p>
<h4>Search View</h4>
</p>
</div>
<div class="" style="text-align: center">
<div class="oe_demo oe_picture oe_screenshot">
<img style="border:10px solid white;" src="groupby.png">
</div>
</div>
<div class="" style="text-align: center">
<div class="oe_demo oe_picture oe_screenshot">
<img style="border:10px solid white;" src="filter.png">
</div>
</div>
</div>
</section>
<section class="oe_container">
<h2 class="oe_slogan" style="margin-top:20px;" >Need Any Help?</h2>
<div class="oe_slogan" style="margin-top:10px !important;">
<div>
<a class="btn btn-primary btn-lg mt8"
style="color: #FFFFFF !important;border-radius: 0;" href="https://www.cybrosys.com"><i
class="fa fa-envelope"></i> Email </a> <a
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;"
href="https://www.cybrosys.com/contact/"><i
class="fa fa-phone"></i> Contact Us </a> <a
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;"
href="https://www.cybrosys.com/odoo-customization-and-installation/"><i
class="fa fa-check-square"></i> Request Customization </a>
</div>
<br>
<img src="cybro_logo.png" style="width: 190px; margin-bottom: 20px;" class="center-block">
<div>
<a href="https://twitter.com/cybrosys" target="_blank"><i class="fa fa-2x fa-twitter" style="color:white;background: #00a0d1;width:35px;"></i></a></td>
<a href="https://www.linkedin.com/company/cybrosys-technologies-pvt-ltd" target="_blank"><i class="fa fa-2x fa-linkedin" style="color:white;background: #31a3d6;width:35px;padding-left: 3px;"></i></a></td>
<a href="https://www.facebook.com/cybrosystechnologies" target="_blank"><i class="fa fa-2x fa-facebook" style="color:white;background: #3b5998;width:35px;padding-left: 8px;"></i></a></td>
<a href="https://plus.google.com/106641282743045431892/about" target="_blank"><i class="fa fa-2x fa-google-plus" style="color:white;background: #c53c2c;width:35px;padding-left: 3px;"></i></a></td>
<a href="https://in.pinterest.com/cybrosys" target="_blank"><i class="fa fa-2x fa-pinterest" style="color:white;background: #ac0f18;width:35px;padding-left: 3px;"></i></a></td>
</div>
</div>
</section>

BIN
employee_stages/static/description/kanban.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 KiB

BIN
employee_stages/static/description/status1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

BIN
employee_stages/static/description/status2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

BIN
employee_stages/static/description/status3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

BIN
employee_stages/static/description/status5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

BIN
employee_stages/static/description/status6.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

BIN
employee_stages/static/description/tree.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

120
employee_stages/views/employee_stages_view.xml

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record model='ir.ui.view' id='wizard_employee_form'>
<field name="name">wizard.employee.form</field>
<field name="model">wizard.employee.stage</field>
<field name="arch" type="xml">
<form string="Set as Employee">
<group>
<field name="related_user"/>
</group>
<footer>
<button name="set_as_employee" string="Set as Employee" type="object" class="oe_highlight"/>
or
<button string="Cancel" class="oe_link" special="cancel" />
</footer>
</form>
</field>
</record>
<record model='ir.actions.act_window' id='wizard_employee_act'>
<field name="name">Set as Employee</field>
<field name="res_model">wizard.employee.stage</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="wizard_employee_form"/>
<field name="target">new</field>
</record>
<record model="ir.ui.view" id="hr_employee_stages_inherit_form_view">
<field name="name">hr.employee.form.view</field>
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.view_employee_form"/>
<field name="arch" type="xml">
<xpath expr="/form/sheet" position="before">
<header>
<button name="start_grounding" string="Start Grounding" type="object" states="joined"/>
<button name="start_test_period" string="Start Test Period" type="object" states="grounding"/>
<button name="%(employee_stages.wizard_employee_act)d" string="Set as Employee" type="action"
states="joined,test_period" context="{'employee_id':id}"/>
<button name="start_notice_period" string="Start Notice Period" type="object" states="employment"/>
<button name="relived" string="Relieved" type="object" states="notice_period"/>
<button name="terminate" string="Terminate" type="object" states="grounding,employment"/>
<field name="state" widget="statusbar" statusbar_visible="joined,grounding,employment"/>
</header>
</xpath>
<page name="hr_settings" position="after">
<page name="stage_history" string="Status History">
<field name="stages_history">
<tree>
<field name="state"/>
<field name="start_date"/>
<field name="end_date"/>
<field name="duration" sum="Total"/>
</tree>
</field>
</page>
</page>
</field>
</record>
<record model="ir.ui.view" id="hr_employee_stages_inherit_tree_view">
<field name="name">hr.employee.tree.view</field>
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.view_employee_tree"/>
<field name="arch" type="xml">
<field name="message_needaction" position="after">
<field name="state"/>
</field>
</field>
</record>
<record model="ir.ui.view" id="hr_employee_stages_inherit_search_view">
<field name="name">hr.employee.search.view</field>
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.view_employee_filter"/>
<field name="arch" type="xml">
<field name="job_id" position="after">
<field name="state"/>
<filter string="Employees" name="employee" domain="[('state','=','employment')]"/>
</field>
<xpath expr="//group" position="inside">
<filter string="State" domain="[]" context="{'group_by':'state'}"/>
</xpath>
</field>
</record>
<record model="ir.ui.view" id="hr_employee_stages_inherit_kanban_view">
<field name="name">hr.employee.kanban.view</field>
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.hr_kanban_view_employees"/>
<field name="arch" type="xml">
<field name="last_login" position="after">
<field name="state"/>
</field>
<xpath expr="//li[3]" position="after">
<li t-if="record.state.raw_value"><field name="state"/></li>
</xpath>
</field>
</record>
<record id="hr.open_view_employee_list_my" model="ir.actions.act_window">
<field name="name">Employees</field>
<field name="res_model">hr.employee</field>
<field name="view_type">form</field>
<field name="view_mode">kanban,tree,form</field>
<field name="domain">[]</field>
<field name="context">{"search_default_employee":1}</field>
<field name="view_id" eval="False"/>
<field name="search_view_id" ref="hr.view_employee_filter"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to add a new employee.
</p><p>
With just a quick glance on the Odoo employee screen, you
can easily find all the information you need for each person;
contact data, job position, availability, etc.
</p>
</field>
</record>
</odoo>
Loading…
Cancel
Save