Browse Source

[UTD] Sequence Added

pull/78/head
Sreejith 7 years ago
parent
commit
a26c0ca325
  1. 40
      hr_resignation/README.rst
  2. 5
      hr_resignation/__manifest__.py
  3. 6
      hr_resignation/docs/RELEASE_NOTES.md
  4. 1
      hr_resignation/models/__init__.py
  5. 38
      hr_resignation/models/hr_resignation.py
  6. BIN
      hr_resignation/static/description/hr_resignation.gif
  7. 13
      hr_resignation/static/description/index.html
  8. 15
      hr_resignation/views/resignation_sequence.xml
  9. 9
      hr_resignation/views/resignation_view.xml

40
hr_resignation/README.rst

@ -0,0 +1,40 @@
Open HRMS Resignation v10
=========================
Employee Resignation Process.
Depends
=======
[hr_employee_updation] addon Open HRMS
[mail] addon Odoo
Tech
====
* [Python] - Models
* [XML] - Odoo views
Installation
============
- www.odoo.com/documentation/10.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.

5
hr_resignation/__manifest__.py

@ -22,18 +22,19 @@
###################################################################################
{
'name': 'Open HRMS Resignation',
'version': '10.0.1.0.0',
'version': '10.0.1.1.0',
'summary': 'Handle the resignation process of the employee',
'author': 'Cybrosys Techno solutions',
'company': 'Cybrosys Techno Solutions',
'website': 'https://www.openhrms.com',
'depends': ['hr', 'mail'],
'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',
],

6
hr_resignation/docs/RELEASE_NOTES.md

@ -0,0 +1,6 @@
## Module hr_resignation
#### 07.04.2018
#### Version 10.0.1.1.0
##### ADD
- ADD sequence for resignation

1
hr_resignation/models/__init__.py

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

38
hr_resignation/models/hr_resignation.py

@ -11,18 +11,39 @@ class HrResignation(models.Model):
_inherit = 'mail.thread'
_rec_name = 'employee_id'
employee_id = fields.Many2one('hr.employee', string="Employee")
department_id = fields.Many2one('hr.department', string="Department", related='employee_id.department_id')
joined_date = fields.Date(string="Join Date", required=True)
expected_revealing_date = fields.Date(string="Revealing Date", required=True)
resign_confirm_date = fields.Date(string="Resign confirm date")
approved_revealing_date = fields.Date(string="Approved Date")
reason = fields.Text(string="Reason")
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:
@ -31,6 +52,7 @@ class HrResignation(models.Model):
@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),
@ -41,6 +63,7 @@ class HrResignation(models.Model):
@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)
@ -50,6 +73,7 @@ class HrResignation(models.Model):
@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'])])

BIN
hr_resignation/static/description/hr_resignation.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

13
hr_resignation/static/description/index.html

@ -45,6 +45,19 @@
</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">

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>

9
hr_resignation/views/resignation_view.xml

@ -12,6 +12,7 @@
<field name="joined_date"/>
<field name="expected_revealing_date"/>
<field name="approved_revealing_date"/>
<field name="notice_period"/>
</tree>
</field>
</record>
@ -29,7 +30,12 @@
<field name="state" widget="statusbar" statusbar_visible="draft,confirm"/>
</header>
<sheet>
<group string="Resignation Form">
<div class="oe_title">
<h1>
<field name="name" readonly="1"/>
</h1>
</div>
<group>
<group>
<field name="employee_id"/>
<field name="department_id"/>
@ -39,6 +45,7 @@
<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"/>

Loading…
Cancel
Save