Browse Source

[ADD] Initial Commit

pull/72/head
Sreejith P 7 years ago
parent
commit
aad0e63f53
  1. 40
      hr_resignation/README.rst
  2. 2
      hr_resignation/__init__.py
  3. 47
      hr_resignation/__manifest__.py
  4. 6
      hr_resignation/docs/RELEASE_NOTES.md
  5. 2
      hr_resignation/models/__init__.py
  6. 114
      hr_resignation/models/hr_resignation.py
  7. 3
      hr_resignation/security/ir.model.access.csv
  8. 11
      hr_resignation/security/security.xml
  9. BIN
      hr_resignation/static/description/HRMS-BUTTON.png
  10. BIN
      hr_resignation/static/description/banner.jpg
  11. BIN
      hr_resignation/static/description/cybro-service.png
  12. BIN
      hr_resignation/static/description/cybro_logo.png
  13. BIN
      hr_resignation/static/description/hr_resignation.gif
  14. BIN
      hr_resignation/static/description/icon.png
  15. 103
      hr_resignation/static/description/index.html
  16. 22
      hr_resignation/views/approved_resignation.xml
  17. 15
      hr_resignation/views/resignation_sequence.xml
  18. 78
      hr_resignation/views/resignation_view.xml

40
hr_resignation/README.rst

@ -0,0 +1,40 @@
OHRMS Employee Resignation v11
==============================
Employee Resignation Process.
Depends
=======
[hr_employee_updation] addon Open HRMS
[mail] addon Odoo
Tech
====
* [Python] - Models
* [XML] - Odoo views
Installation
============
- www.odoo.com/documentation/11.0/setup/install.html
- Install our custom addon
Bug Tracker
===========
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported.
Credits
=======
* Cybrosys Techno Solutions <https://www.cybrosys.com>
Author
------
Developer: Niyas Raphy @ cybrosys, niyas@cybrosys.in
Maintainer
----------
This module is maintained by Cybrosys Technologies.
For support and more information, please visit https://www.cybrosys.com.

2
hr_resignation/__init__.py

@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from . import models

47
hr_resignation/__manifest__.py

@ -0,0 +1,47 @@
# -*- coding: utf-8 -*-
###################################################################################
# A part of Open HRMS Project <https://www.openhrms.com>
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2018-TODAY Cybrosys Technologies (<https://www.cybrosys.com>).
# Author: Niyas Raphy(<https://www.cybrosys.com>)
#
# This program is free software: you can modify
# it under the terms of the GNU Affero General Public License (AGPL) as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
###################################################################################
{
'name': 'Open HRMS Resignation',
'version': '11.0.1.0.0',
'summary': 'Handle the resignation process of the employee',
'author': 'Cybrosys Techno solutions',
'company': 'Cybrosys Techno Solutions',
'website': 'https://www.openhrms.com',
'depends': ['hr_employee_updation', 'mail'],
'category': 'Human Resources',
'maintainer': 'Cybrosys Techno Solutions',
'demo': [],
'data': [
'views/resignation_view.xml',
'views/approved_resignation.xml',
'views/resignation_sequence.xml',
'security/security.xml',
'security/ir.model.access.csv',
],
'installable': True,
'application': False,
'auto_install': False,
'images': ['static/description/banner.jpg'],
'license': 'AGPL-3',
}

6
hr_resignation/docs/RELEASE_NOTES.md

@ -0,0 +1,6 @@
## Module hr_resignation
#### 07.04.2018
#### Version 11.0.1.0.0
##### ADD
- Initial Commit

2
hr_resignation/models/__init__.py

@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from . import hr_resignation

114
hr_resignation/models/hr_resignation.py

@ -0,0 +1,114 @@
# -*- coding: utf-8 -*-
import datetime
from datetime import datetime
from odoo import models, fields, api, _
from odoo.exceptions import ValidationError
date_format = "%Y-%m-%d"
class HrResignation(models.Model):
_name = 'hr.resignation'
_inherit = 'mail.thread'
_rec_name = 'employee_id'
def _get_employee_id(self):
# assigning the related employee of the logged in user
employee_rec = self.env['hr.employee'].search([('user_id', '=', self.env.uid)], limit=1)
return employee_rec.id
name = fields.Char(string='Order Reference', required=True, copy=False, readonly=True, index=True,
default=lambda self: _('New'))
employee_id = fields.Many2one('hr.employee', string="Employee", default=_get_employee_id,
help='Name of the employee for whom the request is creating')
department_id = fields.Many2one('hr.department', string="Department", related='employee_id.department_id',
help='Department of the employee')
joined_date = fields.Date(string="Join Date", required=True, related='employee_id.joining_date',
help='Joining date of the employee')
expected_revealing_date = fields.Date(string="Revealing Date", required=True,
help='Date on which he is revealing from the company')
resign_confirm_date = fields.Date(string="Resign confirm date", help='Date on which the request is confirmed')
approved_revealing_date = fields.Date(string="Approved Date", help='The date approved for the revealing')
reason = fields.Text(string="Reason", help='Specify reason for leaving the company')
notice_period = fields.Char(string="Notice Period", compute='_notice_period')
state = fields.Selection([('draft', 'Draft'), ('confirm', 'Confirm'), ('approved', 'Approved'), ('cancel', 'Cancel')],
string='Status', default='draft')
@api.model
def create(self, vals):
# assigning the sequence for the record
if vals.get('name', _('New')) == _('New'):
vals['name'] = self.env['ir.sequence'].next_by_code('hr.resignation') or _('New')
res = super(HrResignation, self).create(vals)
return res
@api.constrains('employee_id')
def check_employee(self):
# Checking whether the user is creating leave request of his/her own
for rec in self:
if not self.env.user.has_group('hr.group_hr_user'):
if rec.employee_id.user_id.id and rec.employee_id.user_id.id != self.env.uid:
raise ValidationError(_('You cannot create request for other employees'))
@api.onchange('employee_id')
@api.depends('employee_id')
def check_request_existence(self):
# Check whether any resignation request already exists
for rec in self:
if rec.employee_id:
resignation_request = self.env['hr.resignation'].search([('employee_id', '=', rec.employee_id.id),
('state', 'in', ['confirm', 'approved'])])
if resignation_request:
raise ValidationError(_('There is a resignation request in confirmed or'
' approved state for this employee'))
@api.multi
def _notice_period(self):
# calculating the notice period for the employee
for rec in self:
if rec.approved_revealing_date and rec.resign_confirm_date:
approved_date = datetime.strptime(rec.approved_revealing_date, date_format)
confirmed_date = datetime.strptime(rec.resign_confirm_date, date_format)
notice_period = approved_date - confirmed_date
rec.notice_period = notice_period.days
@api.constrains('joined_date', 'expected_revealing_date')
def _check_dates(self):
# validating the entered dates
for rec in self:
resignation_request = self.env['hr.resignation'].search([('employee_id', '=', rec.employee_id.id),
('state', 'in', ['confirm', 'approved'])])
if resignation_request:
raise ValidationError(_('There is a resignation request in confirmed or'
' approved state for this employee'))
if rec.joined_date >= rec.expected_revealing_date:
raise ValidationError(_('Revealing date must be anterior to joining date'))
@api.multi
def confirm_resignation(self):
for rec in self:
rec.state = 'confirm'
rec.resign_confirm_date = datetime.now()
@api.multi
def cancel_resignation(self):
for rec in self:
rec.state = 'cancel'
@api.multi
def reject_resignation(self):
for rec in self:
rec.state = 'rejected'
@api.multi
def approve_resignation(self):
for rec in self:
if not rec.approved_revealing_date:
raise ValidationError(_('Enter Approved Revealing Date'))
if rec.approved_revealing_date and rec.resign_confirm_date:
if rec.approved_revealing_date <= rec.resign_confirm_date:
raise ValidationError(_('Approved revealing date must be anterior to confirmed date'))
rec.state = 'approved'

3
hr_resignation/security/ir.model.access.csv

@ -0,0 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
view_hr_resignation,view.hr.resignation,hr_resignation.model_hr_resignation,base.group_user,1,1,1,0
view_hr_employee,view.hr.employee,hr.model_hr_employee,base.group_user,1,1,1,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 view_hr_resignation view.hr.resignation hr_resignation.model_hr_resignation base.group_user 1 1 1 0
3 view_hr_employee view.hr.employee hr.model_hr_employee base.group_user 1 1 1 0

11
hr_resignation/security/security.xml

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="hr_resignation_personal_rule" model="ir.rule">
<field name="name">Employee Resignation</field>
<field ref="hr_resignation.model_hr_resignation" name="model_id"/>
<field name="domain_force">['|',('employee_id.user_id','=',user.id),('employee_id.user_id','=',False)]</field>
<field name="groups" eval="[(4, ref('base.group_user'))]"/>
</record>
</data>
</odoo>

BIN
hr_resignation/static/description/HRMS-BUTTON.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
hr_resignation/static/description/banner.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

BIN
hr_resignation/static/description/cybro-service.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 KiB

BIN
hr_resignation/static/description/cybro_logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
hr_resignation/static/description/hr_resignation.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

BIN
hr_resignation/static/description/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

103
hr_resignation/static/description/index.html

@ -0,0 +1,103 @@
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<h2 class="oe_slogan">Open HRMS</h2>
<h3 class="oe_slogan">Most advanced open source HR management software</h3>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced oe_mt32">
<div class="oe_span">
<div class="oe_demo oe_picture oe_screenshot">
<a href="https://www.openhrms.com/#request-demo">
<img src="HRMS-BUTTON.png">
</a>
</div>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan">Employee Resignation</h2>
<h3 class="oe_slogan">Easily create, manage, and track employee resignations.</h3>
<h3 class="oe_slogan"><a href="https://www.cybrosys.com">Cybrosys Technologies</a> </h3>
</div>
<div class="oe_row oe_spaced">
<h4><p style="margin-left: 42px;">Major Features:</p></h4>
<ul>
<li style="list-style:none !important;"><span style="color:green;"> &#9733;</span>&nbsp;&nbsp;Employee will create his/her resignation request</li>
<li style="list-style:none !important;"><span style="color:green;"> &#9733;</span>&nbsp;&nbsp;Higher level officers can approve or reject the request</li>
</ul>
</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">
Employee Resignation is a component of Open HRMS suit. This module manages employee resignation process.
Employee can fill and send resignation request from their portal and higher level officers can take
appropriate actions on it.
</p>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div class="" style="text-align: center;">
<h3 class="oe_slogan">Working</h3>
<div class="oe_span12">
<div class="oe_demo oe_picture oe_screenshot">
<img style="border:10px solid white;" src="hr_resignation.gif">
</div>
</div>
</div>
</div>
</section>
<div class="row section-content">
<div class="col-md-6 img-content">
<h3>Our Odoo Services</h3>
</div>
<div class="bc-span col-md-12">
<div class="inner-span">
<a target="_blank" href="https://www.openhrms.com">
<img class="img-border img-responsive thumbnail" src="cybro-service.png">
</a>
</div>
</div>
</div>
<section class="oe_container oe_dark">
<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/contact/" target="_blank"><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.odoo.com/apps/modules/browse?search=open+hrms" target="_blank"><i
class="fa fa-suitcase"></i> Other Open HRMS Addons </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/" target="_blank"><i
class="fa fa-wrench"></i> Request Customization </a>
</div>
<br>
<a href="https://www.cybrosys.com/" target="_blank">
<img src="cybro_logo.png" style="width: 190px; margin-bottom: 20px;" class="center-block">
</a>
</div>
</section>

22
hr_resignation/views/approved_resignation.xml

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<record model="ir.actions.act_window" id="view_approved_resignation">
<field name="name">Approved Resignation</field>
<field name="res_model">hr.resignation</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('state', '=', 'approved')]</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">Approved Resignation
</p>
</field>
</record>
<menuitem id="employee_resignation_approved" parent="employee_resignation" name="Approved Resignation"
action="view_approved_resignation" groups="base.group_user" sequence="4"/>
</data>
</odoo>

15
hr_resignation/views/resignation_sequence.xml

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<!-- Sequences for hr.resignation -->
<record id="seq_hr_resignation" model="ir.sequence">
<field name="name">Open HRMS Resignation</field>
<field name="code">hr.resignation</field>
<field name="prefix">RES</field>
<field name="padding">3</field>
<field name="company_id" eval="False"/>
</record>
</data>
</odoo>

78
hr_resignation/views/resignation_view.xml

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<record id="employee_resignation_tree" model="ir.ui.view">
<field name="name">hr.resignation.tree</field>
<field name="model">hr.resignation</field>
<field name="priority" eval="8" />
<field name="arch" type="xml">
<tree string="Employee Resignation">
<field name="employee_id"/>
<field name="department_id"/>
<field name="joined_date"/>
<field name="expected_revealing_date"/>
<field name="approved_revealing_date"/>
<field name="notice_period"/>
</tree>
</field>
</record>
<record id="employee_resignation_form" model="ir.ui.view">
<field name="name">hr.resignation.form</field>
<field name="model">hr.resignation</field>
<field name="priority" eval="8" />
<field name="arch" type="xml">
<form string="Employee Resignation">
<header>
<button string="Confirm" type="object" name="confirm_resignation" states='draft' class="oe_highlight"/>
<button string="Cancel" type="object" name="cancel_resignation" states='draft'/>
<button string="Approve" type="object" groups="hr.group_hr_user" name="approve_resignation" states='confirm'/>
<button string="Reject" type="object" groups="hr.group_hr_user" name="reject_resignation" states='confirm'/>
<field name="state" widget="statusbar" statusbar_visible="draft,confirm"/>
</header>
<sheet>
<div class="oe_title">
<h1>
<field name="name" readonly="1"/>
</h1>
</div>
<group>
<group>
<field name="employee_id"/>
<field name="department_id"/>
<field name="joined_date"/>
<field name="resign_confirm_date" class="oe_read_only" attrs="{'invisible':[('resign_confirm_date','=','')]}"/>
</group>
<group>
<field name="expected_revealing_date"/>
<field name="approved_revealing_date" states="confirm,approved"/>
<field name="notice_period" states="confirm,approved"/>
</group>
</group>
<field name="reason"/>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers"/>
<field name="message_ids" widget="mail_thread"/>
</div>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="view_employee_resignation">
<field name="name">Employee Resignation</field>
<field name="res_model">hr.resignation</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('state', 'in', ('draft', 'confirm'))]</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">Employee Resignation Form
</p>
</field>
</record>
<menuitem id="employee_resignation" parent="hr.menu_hr_root" name="Resignation"
groups="base.group_user" sequence="21"/>
<menuitem id="employee_resignation_request" parent="employee_resignation" name="Resignation Request"
action="view_employee_resignation" groups="base.group_user" sequence="4"/>
</data>
</odoo>
Loading…
Cancel
Save