14 changed files with 331 additions and 0 deletions
			
			
		@ -0,0 +1,2 @@ | 
				
			|||||
 | 
					# -*- coding: utf-8 -*- | 
				
			||||
 | 
					from . import models | 
				
			||||
@ -0,0 +1,46 @@ | 
				
			|||||
 | 
					# -*- coding: utf-8 -*- | 
				
			||||
 | 
					################################################################################### | 
				
			||||
 | 
					#    A part of OpenHRMS 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': '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', | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
@ -0,0 +1,3 @@ | 
				
			|||||
 | 
					# -*- coding: utf-8 -*- | 
				
			||||
 | 
					from . import hr_resignation | 
				
			||||
 | 
					
 | 
				
			||||
@ -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' | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
		
		
			
  | 
@ -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> | 
				
			||||
| 
		 After Width: | Height: | Size: 17 KiB  | 
| 
		 After Width: | Height: | Size: 118 KiB  | 
| 
		 After Width: | Height: | Size: 221 KiB  | 
| 
		 After Width: | Height: | Size: 50 KiB  | 
| 
		 After Width: | Height: | Size: 31 KiB  | 
@ -0,0 +1,83 @@ | 
				
			|||||
 | 
					<section class="oe_container oe_dark"> | 
				
			||||
 | 
					    <div class="oe_row oe_spaced"> | 
				
			||||
 | 
					        <h2 class="oe_slogan">OpenHRMS</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 class="oe_demo_footer oe_centeralign">Online Demo</div> | 
				
			||||
 | 
					            </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;"> ★</span>  Employee will create his/her resignation request</li> | 
				
			||||
 | 
					                <li style="list-style:none !important;"><span style="color:green;"> ★</span>  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> | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					<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"> | 
				
			||||
 | 
					    <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> | 
				
			||||
 | 
					</section> | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
@ -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> | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
@ -0,0 +1,71 @@ | 
				
			|||||
 | 
					<?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"/> | 
				
			||||
 | 
					                </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> | 
				
			||||
 | 
					                        <group string="Resignation Form"> | 
				
			||||
 | 
					                            <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"/> | 
				
			||||
 | 
					                            </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…
					
					
				
		Reference in new issue