diff --git a/hr_resignation/README.rst b/hr_resignation/README.rst new file mode 100644 index 000000000..32cfb5522 --- /dev/null +++ b/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 + +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/__manifest__.py b/hr_resignation/__manifest__.py index 9d68196d6..ea97dd617 100644 --- a/hr_resignation/__manifest__.py +++ b/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', ], diff --git a/hr_resignation/docs/RELEASE_NOTES.md b/hr_resignation/docs/RELEASE_NOTES.md new file mode 100644 index 000000000..8c6e3967a --- /dev/null +++ b/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 diff --git a/hr_resignation/models/__init__.py b/hr_resignation/models/__init__.py index f1edfba36..fb9ec22ad 100644 --- a/hr_resignation/models/__init__.py +++ b/hr_resignation/models/__init__.py @@ -1,3 +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 index 269c8f24c..6bd2f1e09 100644 --- a/hr_resignation/models/hr_resignation.py +++ b/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'])]) 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/index.html b/hr_resignation/static/description/index.html index 6c1c99578..54b52671e 100644 --- a/hr_resignation/static/description/index.html +++ b/hr_resignation/static/description/index.html @@ -45,6 +45,19 @@ +
+
+
+

Working

+
+
+ +
+
+
+
+
+
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 index b3995574e..745698414 100644 --- a/hr_resignation/views/resignation_view.xml +++ b/hr_resignation/views/resignation_view.xml @@ -12,6 +12,7 @@ + @@ -29,7 +30,12 @@ - +
+

+ +

+
+ @@ -39,6 +45,7 @@ +