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..5f6586294 --- /dev/null +++ b/hr_resignation/__manifest__.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +################################################################################### +# A part of OpenHRMS 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': 'OHRMS HR Resignation', + 'version': '10.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', 'mail'], + 'category': 'Human Resources', + 'maintainer': 'Cybrosys Techno Solutions', + 'demo': [], + 'data': [ + 'views/resignation_view.xml', + 'views/approved_resignation.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/models/__init__.py b/hr_resignation/models/__init__.py new file mode 100644 index 000000000..f1edfba36 --- /dev/null +++ b/hr_resignation/models/__init__.py @@ -0,0 +1,3 @@ +# -*- 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..269c8f24c --- /dev/null +++ b/hr_resignation/models/hr_resignation.py @@ -0,0 +1,90 @@ +# -*- 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' + + 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") + state = fields.Selection([('draft', 'Draft'), ('confirm', 'Confirm'), ('approved', 'Approved'), ('cancel', 'Cancel')], + string='Status', default='draft') + + @api.constrains('employee_id') + def check_employee(self): + 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): + 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): + 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): + 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/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..53ef09a0f --- /dev/null +++ b/hr_resignation/static/description/index.html @@ -0,0 +1,83 @@ +
+
+

OpenHRMS

+

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

+
+
+
+ + +
+
+

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_view.xml b/hr_resignation/views/resignation_view.xml new file mode 100644 index 000000000..b3995574e --- /dev/null +++ b/hr_resignation/views/resignation_view.xml @@ -0,0 +1,71 @@ + + + + + hr.resignation.tree + hr.resignation + + + + + + + + + + + + + hr.resignation.form + hr.resignation + + +
+
+
+ + + + + + + + + + + + + + + +
+ + +
+
+
+
+ + Employee Resignation + hr.resignation + form + tree,form + [('state', 'in', ('draft', 'confirm'))] + +

Employee Resignation Form +

+
+
+ + +
+
+ +