diff --git a/hr_resignation/README.rst b/hr_resignation/README.rst new file mode 100644 index 000000000..156dc316f --- /dev/null +++ b/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 + +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. diff --git a/hr_resignation/__init__.py b/hr_resignation/__init__.py new file mode 100644 index 000000000..a0fdc10fe --- /dev/null +++ b/hr_resignation/__init__.py @@ -0,0 +1,2 @@ +# -*- coding: utf-8 -*- +from . import models diff --git a/hr_resignation/__manifest__.py b/hr_resignation/__manifest__.py new file mode 100644 index 000000000..9ad8a9da0 --- /dev/null +++ b/hr_resignation/__manifest__.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +################################################################################### +# A part of Open HRMS Project +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2018-TODAY Cybrosys Technologies (). +# Author: Niyas Raphy() +# +# 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 . +# +################################################################################### +{ + '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', +} + diff --git a/hr_resignation/docs/RELEASE_NOTES.md b/hr_resignation/docs/RELEASE_NOTES.md new file mode 100644 index 000000000..1adf02753 --- /dev/null +++ b/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 diff --git a/hr_resignation/models/__init__.py b/hr_resignation/models/__init__.py new file mode 100644 index 000000000..fb9ec22ad --- /dev/null +++ b/hr_resignation/models/__init__.py @@ -0,0 +1,2 @@ +# -*- coding: utf-8 -*- +from . import hr_resignation diff --git a/hr_resignation/models/hr_resignation.py b/hr_resignation/models/hr_resignation.py new file mode 100644 index 000000000..6bd2f1e09 --- /dev/null +++ b/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' + + + + diff --git a/hr_resignation/security/ir.model.access.csv b/hr_resignation/security/ir.model.access.csv new file mode 100644 index 000000000..62723a73b --- /dev/null +++ b/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 diff --git a/hr_resignation/security/security.xml b/hr_resignation/security/security.xml new file mode 100644 index 000000000..25074e4c0 --- /dev/null +++ b/hr_resignation/security/security.xml @@ -0,0 +1,11 @@ + + + + + Employee Resignation + + ['|',('employee_id.user_id','=',user.id),('employee_id.user_id','=',False)] + + + + diff --git a/hr_resignation/static/description/HRMS-BUTTON.png b/hr_resignation/static/description/HRMS-BUTTON.png new file mode 100644 index 000000000..0f1b65bea Binary files /dev/null and b/hr_resignation/static/description/HRMS-BUTTON.png differ diff --git a/hr_resignation/static/description/banner.jpg b/hr_resignation/static/description/banner.jpg new file mode 100644 index 000000000..a41f52839 Binary files /dev/null and b/hr_resignation/static/description/banner.jpg differ diff --git a/hr_resignation/static/description/cybro-service.png b/hr_resignation/static/description/cybro-service.png new file mode 100644 index 000000000..252929a86 Binary files /dev/null and b/hr_resignation/static/description/cybro-service.png differ diff --git a/hr_resignation/static/description/cybro_logo.png b/hr_resignation/static/description/cybro_logo.png new file mode 100644 index 000000000..bb309114c Binary files /dev/null and b/hr_resignation/static/description/cybro_logo.png differ diff --git a/hr_resignation/static/description/hr_resignation.gif b/hr_resignation/static/description/hr_resignation.gif new file mode 100644 index 000000000..ef8e29c07 Binary files /dev/null and b/hr_resignation/static/description/hr_resignation.gif differ diff --git a/hr_resignation/static/description/icon.png b/hr_resignation/static/description/icon.png new file mode 100644 index 000000000..94d726147 Binary files /dev/null and b/hr_resignation/static/description/icon.png differ diff --git a/hr_resignation/static/description/index.html b/hr_resignation/static/description/index.html new file mode 100644 index 000000000..57887d6fc --- /dev/null +++ b/hr_resignation/static/description/index.html @@ -0,0 +1,103 @@ +
+
+

Open HRMS

+

Most advanced open source HR management software

+
+
+
+
+
+
+ + + +
+
+
+
+
+
+
+

Employee Resignation

+

Easily create, manage, and track employee resignations.

+

Cybrosys Technologies

+
+
+

Major Features:

+
    +
  •   Employee will create his/her resignation request
  • +
  •   Higher level officers can approve or reject the request
  • +
+
+
+
+ +
+
+
+

Overview

+

+ 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. +

+
+
+
+ +
+
+
+

Working

+
+
+ +
+
+
+
+
+ + +
+
+

Our Odoo Services

+
+
+
+ + + +
+
+
+ +
+

Need Any Help?

+ +
+ + + diff --git a/hr_resignation/views/approved_resignation.xml b/hr_resignation/views/approved_resignation.xml new file mode 100644 index 000000000..b53497528 --- /dev/null +++ b/hr_resignation/views/approved_resignation.xml @@ -0,0 +1,22 @@ + + + + + + Approved Resignation + hr.resignation + form + tree,form + [('state', '=', 'approved')] + +

Approved Resignation +

+
+
+ + +
+
+ + diff --git a/hr_resignation/views/resignation_sequence.xml b/hr_resignation/views/resignation_sequence.xml new file mode 100644 index 000000000..65ee9ee4b --- /dev/null +++ b/hr_resignation/views/resignation_sequence.xml @@ -0,0 +1,15 @@ + + + + + + + Open HRMS Resignation + hr.resignation + RES + 3 + + + + + diff --git a/hr_resignation/views/resignation_view.xml b/hr_resignation/views/resignation_view.xml new file mode 100644 index 000000000..745698414 --- /dev/null +++ b/hr_resignation/views/resignation_view.xml @@ -0,0 +1,78 @@ + + + + + hr.resignation.tree + hr.resignation + + + + + + + + + + + + + + hr.resignation.form + hr.resignation + + +
+
+
+ +
+

+ +

+
+ + + + + + + + + + + + + + +
+
+ + +
+
+
+
+ + Employee Resignation + hr.resignation + form + tree,form + [('state', 'in', ('draft', 'confirm'))] + +

Employee Resignation Form +

+
+
+ + +
+
+ +