@ -1,47 +0,0 @@ |
|||||
Open HRMS Custody Management |
|
||||
============================ |
|
||||
|
|
||||
Functionality to give and track the assets of a company to employees. |
|
||||
- Creates a new menu item Custody Management under Employees |
|
||||
- Can create custody contract with an employee |
|
||||
- Can take the report of custody |
|
||||
|
|
||||
Depends |
|
||||
======= |
|
||||
[hr, mail, hr_employee_updation] addon Odoo |
|
||||
|
|
||||
Tech |
|
||||
==== |
|
||||
* [Python] - Models |
|
||||
* [XML] - Odoo views |
|
||||
|
|
||||
Installation |
|
||||
============ |
|
||||
- www.odoo.com/documentation/10.0/setup/install.html |
|
||||
- Install our custom addon |
|
||||
|
|
||||
License |
|
||||
======= |
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE, Version 3 (AGPLv3) |
|
||||
(http://www.gnu.org/licenses/agpl.html) |
|
||||
|
|
||||
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 |
|
||||
------ |
|
||||
|
|
||||
Developers: Avinash Nk <avinash@cybrosys.in> |
|
||||
Jesni Banu <jesni@cybrosys.in> |
|
||||
|
|
||||
Maintainer |
|
||||
---------- |
|
||||
|
|
||||
This module is maintained by Cybrosys Technologies. |
|
||||
|
|
||||
For support and more information, please visit https://www.cybrosys.com. |
|
@ -1,24 +0,0 @@ |
|||||
# -*- 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>). |
|
||||
# Authors: Avinash Nk, Jesni Banu (<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/>. |
|
||||
# |
|
||||
################################################################################### |
|
||||
from . import models |
|
||||
from . import reports |
|
@ -1,50 +0,0 @@ |
|||||
# -*- coding: utf-8 -*- |
|
||||
################################################################################### |
|
||||
# A part of Open HRMS Project <https://www.openhrms.com> |
|
||||
# |
|
||||
# Cybrosys Technologies Pvt. Ltd. |
|
||||
# Copyright (C) 2018-TODAY Cybrosys Technologies (<https://www.cybrosys.com>). |
|
||||
# Authors: Avinash Nk, Jesni Banu (<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': 'Open HRMS Custody', |
|
||||
'version': '10.0.1.0.0', |
|
||||
'summary': """Manage the company properties when it is in the custody of an employee""", |
|
||||
'description': 'Manage the company properties when it is in the custody of an employee', |
|
||||
'category': 'Human Resources', |
|
||||
'author': 'Cybrosys Techno Solutions', |
|
||||
'company': 'Cybrosys Techno Solutions', |
|
||||
'maintainer': 'Cybrosys Techno Solutions', |
|
||||
'website': "https://www.openhrms.com", |
|
||||
'depends': ['hr', 'mail', 'hr_employee_updation'], |
|
||||
'data': [ |
|
||||
'security/ir.model.access.csv', |
|
||||
'security/custody_security.xml', |
|
||||
'views/wizard_reason_view.xml', |
|
||||
'views/custody_view.xml', |
|
||||
'views/hr_custody_notification.xml', |
|
||||
'views/hr_employee_view.xml', |
|
||||
'views/notification_mail.xml', |
|
||||
'reports/custody_report.xml' |
|
||||
], |
|
||||
'images': ['static/description/banner.jpg'], |
|
||||
'license': 'AGPL-3', |
|
||||
'demo': [], |
|
||||
'installable': True, |
|
||||
'auto_install': False, |
|
||||
'application': False, |
|
||||
} |
|
@ -1,6 +0,0 @@ |
|||||
## Module hr_custody |
|
||||
|
|
||||
#### 30.03.2018 |
|
||||
#### Version 10.0.1.0.0 |
|
||||
##### ADD |
|
||||
- Initial commit for OpenHrms Project |
|
@ -1,25 +0,0 @@ |
|||||
# -*- 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>). |
|
||||
# Authors: Avinash Nk, Jesni Banu (<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/>. |
|
||||
# |
|
||||
################################################################################### |
|
||||
from . import custody |
|
||||
from . import hr_employee |
|
||||
from . import wizard_reason |
|
@ -1,208 +0,0 @@ |
|||||
# -*- 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>). |
|
||||
# Authors: Avinash Nk, Jesni Banu (<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/>. |
|
||||
# |
|
||||
################################################################################### |
|
||||
from datetime import datetime, timedelta |
|
||||
from odoo import models, fields, api, _ |
|
||||
from odoo.exceptions import Warning, UserError |
|
||||
from odoo.tools import image_resize_images |
|
||||
|
|
||||
|
|
||||
class HrCustody(models.Model): |
|
||||
""" |
|
||||
Hr custody contract creation model. |
|
||||
""" |
|
||||
_name = 'hr.custody' |
|
||||
_description = 'Hr Custody Management' |
|
||||
_inherit = ['mail.thread', 'ir.needaction_mixin'] |
|
||||
|
|
||||
def mail_reminder(self): |
|
||||
now = datetime.now() + timedelta(days=1) |
|
||||
date_now = now.date() |
|
||||
match = self.search([('state', '=', 'approved')]) |
|
||||
for i in match: |
|
||||
if i.return_date: |
|
||||
exp_date = fields.Date.from_string(i.return_date) |
|
||||
if exp_date <= date_now: |
|
||||
base_url = self.env['ir.config_parameter'].get_param('web.base.url') |
|
||||
url = base_url + _('/web#id=%s&view_type=form&model=hr.custody&menu_id=') % i.id |
|
||||
mail_content = _('Hi %s,<br>As per the %s you took %s on %s for the reason of %s. S0 here we ' |
|
||||
'remind you that you have to return that on or before %s. Otherwise, you can ' |
|
||||
'renew the reference number(%s) by extending the return date through following ' |
|
||||
'link.<br> <div style = "text-align: center; margin-top: 16px;"><a href = "%s"' |
|
||||
'style = "padding: 5px 10px; font-size: 12px; line-height: 18px; color: #FFFFFF; ' |
|
||||
'border-color:#875A7B;text-decoration: none; display: inline-block; ' |
|
||||
'margin-bottom: 0px; font-weight: 400;text-align: center; vertical-align: middle; ' |
|
||||
'cursor: pointer; white-space: nowrap; background-image: none; ' |
|
||||
'background-color: #875A7B; border: 1px solid #875A7B; border-radius:3px;">' |
|
||||
'Renew %s</a></div>') % \ |
|
||||
(i.employee.name, i.name, i.custody_name.name, i.date_request, i.purpose, |
|
||||
date_now, i.name, url, i.name) |
|
||||
main_content = { |
|
||||
'subject': _('REMINDER On %s') % i.name, |
|
||||
'author_id': self.env.user.partner_id.id, |
|
||||
'body_html': mail_content, |
|
||||
'email_to': i.employee.work_email, |
|
||||
} |
|
||||
mail_id = self.env['mail.mail'].create(main_content) |
|
||||
mail_id.mail_message_id.body = mail_content |
|
||||
mail_id.send() |
|
||||
if i.employee.user_id: |
|
||||
mail_id.mail_message_id.write({'needaction_partner_ids': [(4, i.employee.user_id.partner_id.id)]}) |
|
||||
mail_id.mail_message_id.write({'partner_ids': [(4, i.employee.user_id.partner_id.id)]}) |
|
||||
|
|
||||
@api.model |
|
||||
def create(self, vals): |
|
||||
vals['name'] = self.env['ir.sequence'].next_by_code('hr.custody') |
|
||||
return super(HrCustody, self).create(vals) |
|
||||
|
|
||||
@api.multi |
|
||||
def sent(self): |
|
||||
self.state = 'to_approve' |
|
||||
|
|
||||
@api.multi |
|
||||
def send_mail(self): |
|
||||
template = self.env.ref('hr_custody.custody_email_notification_template') |
|
||||
self.env['mail.template'].browse(template.id).send_mail(self.id) |
|
||||
self.mail_send = True |
|
||||
|
|
||||
@api.multi |
|
||||
def set_to_draft(self): |
|
||||
self.state = 'draft' |
|
||||
|
|
||||
@api.multi |
|
||||
def renew_approve(self): |
|
||||
for custody in self.env['hr.custody'].search([('custody_name', '=', self.custody_name.id)]): |
|
||||
if custody.state == "approved": |
|
||||
raise UserError(_("Custody is not available now")) |
|
||||
self.return_date = self.renew_date |
|
||||
self.renew_date = '' |
|
||||
self.state = 'approved' |
|
||||
|
|
||||
@api.multi |
|
||||
def renew_refuse(self): |
|
||||
for custody in self.env['hr.custody'].search([('custody_name', '=', self.custody_name.id)]): |
|
||||
if custody.state == "approved": |
|
||||
raise UserError(_("Custody is not available now")) |
|
||||
self.renew_date = '' |
|
||||
self.state = 'approved' |
|
||||
|
|
||||
@api.multi |
|
||||
def approve(self): |
|
||||
for custody in self.env['hr.custody'].search([('custody_name', '=', self.custody_name.id)]): |
|
||||
if custody.state == "approved": |
|
||||
raise UserError(_("Custody is not available now")) |
|
||||
self.state = 'approved' |
|
||||
|
|
||||
@api.multi |
|
||||
def set_to_return(self): |
|
||||
self.state = 'returned' |
|
||||
self.return_date = fields.datetime.now() |
|
||||
|
|
||||
# return date validation |
|
||||
@api.constrains('return_date') |
|
||||
def validate_return_date(self): |
|
||||
if self.return_date < self.date_request: |
|
||||
raise Warning('Please Give Valid Return Date') |
|
||||
|
|
||||
name = fields.Char(string='Code', copy=False) |
|
||||
company_id = fields.Many2one('res.company', 'Company', readonly=True, |
|
||||
default=lambda self: self.env.user.company_id) |
|
||||
rejected_reason = fields.Text(string='Rejected Reason', copy=False, readonly=1) |
|
||||
renew_rejected_reason = fields.Text(string='Renew Rejected Reason', copy=False, readonly=1) |
|
||||
date_request = fields.Date(string='Requested Date', required=True, track_visibility='always', readonly=True, |
|
||||
states={'draft': [('readonly', False)]}) |
|
||||
employee = fields.Many2one('hr.employee', string='Employee', required=True, readonly=True, |
|
||||
states={'draft': [('readonly', False)]}) |
|
||||
purpose = fields.Char(string='Reason', track_visibility='always', required=True, readonly=True, |
|
||||
states={'draft': [('readonly', False)]}) |
|
||||
custody_name = fields.Many2one('custody.property', string='Property', required=True, readonly=True, |
|
||||
states={'draft': [('readonly', False)]}) |
|
||||
return_date = fields.Date(string='Return Date', required=True, track_visibility='always', readonly=True, |
|
||||
states={'draft': [('readonly', False)]}) |
|
||||
renew_date = fields.Date(string='Renewal Return Date', track_visibility='always', readonly=True, copy=False) |
|
||||
notes = fields.Html(string='Notes') |
|
||||
renew_return_date = fields.Boolean(default=False, copy=False) |
|
||||
renew_reject = fields.Boolean(default=False, copy=False) |
|
||||
state = fields.Selection([('draft', 'Draft'), ('to_approve', 'Waiting For Approval'), ('approved', 'Approved'), |
|
||||
('returned', 'Returned'), ('rejected', 'Refused')], string='Status', default='draft', |
|
||||
track_visibility='always') |
|
||||
mail_send = fields.Boolean(string="Mail Send") |
|
||||
|
|
||||
|
|
||||
class HrPropertyName(models.Model): |
|
||||
""" |
|
||||
Hr property creation model. |
|
||||
""" |
|
||||
_name = 'custody.property' |
|
||||
_description = 'Property Name' |
|
||||
|
|
||||
name = fields.Char(string='Property Name', required=True) |
|
||||
image = fields.Binary( |
|
||||
"Image", attachment=True, |
|
||||
help="This field holds the image used for this provider, limited to 1024x1024px") |
|
||||
image_medium = fields.Binary( |
|
||||
"Medium-sized image", attachment=True, |
|
||||
help="Medium-sized image of this provider. It is automatically " |
|
||||
"resized as a 128x128px image, with aspect ratio preserved. " |
|
||||
"Use this field in form views or some kanban views.") |
|
||||
image_small = fields.Binary( |
|
||||
"Small-sized image", attachment=True, |
|
||||
help="Small-sized image of this provider. It is automatically " |
|
||||
"resized as a 64x64px image, with aspect ratio preserved. " |
|
||||
"Use this field anywhere a small image is required.") |
|
||||
desc = fields.Html(string='Description') |
|
||||
company_id = fields.Many2one('res.company', 'Company', |
|
||||
default=lambda self: self.env.user.company_id) |
|
||||
|
|
||||
@api.model |
|
||||
def create(self, vals): |
|
||||
image_resize_images(vals) |
|
||||
return super(HrPropertyName, self).create(vals) |
|
||||
|
|
||||
@api.multi |
|
||||
def write(self, vals): |
|
||||
image_resize_images(vals) |
|
||||
return super(HrPropertyName, self).write(vals) |
|
||||
|
|
||||
|
|
||||
class HrReturnDate(models.TransientModel): |
|
||||
"""Hr custody contract renewal wizard""" |
|
||||
_name = 'wizard.return.date' |
|
||||
_description = 'Hr Custody Name' |
|
||||
|
|
||||
returned_date = fields.Date(string='Renewal Date', required=1) |
|
||||
|
|
||||
# renewal date validation |
|
||||
@api.constrains('returned_date') |
|
||||
def validate_return_date(self): |
|
||||
context = self._context |
|
||||
custody_obj = self.env['hr.custody'].search([('id', '=', context.get('custody_id'))]) |
|
||||
if self.returned_date <= custody_obj.date_request: |
|
||||
raise Warning('Please Give Valid Renewal Date') |
|
||||
|
|
||||
@api.multi |
|
||||
def proceed(self): |
|
||||
context = self._context |
|
||||
custody_obj = self.env['hr.custody'].search([('id', '=', context.get('custody_id'))]) |
|
||||
custody_obj.write({'renew_return_date': True, |
|
||||
'renew_date': self.returned_date, |
|
||||
'state': 'to_approve'}) |
|
@ -1,118 +0,0 @@ |
|||||
# -*- 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>). |
|
||||
# Authors: Avinash Nk, Jesni Banu (<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/>. |
|
||||
# |
|
||||
################################################################################### |
|
||||
from odoo import models, fields, api, _ |
|
||||
|
|
||||
|
|
||||
class HrCustody(models.Model): |
|
||||
_inherit = 'hr.employee' |
|
||||
|
|
||||
custody_count = fields.Integer(compute='_custody_count', string='# Custody') |
|
||||
equipment_count = fields.Integer(compute='_equipment_count', string='# Equipments') |
|
||||
|
|
||||
# count of all custody contracts |
|
||||
@api.multi |
|
||||
def _custody_count(self): |
|
||||
for each in self: |
|
||||
custody_ids = self.env['hr.custody'].search([('employee', '=', each.id)]) |
|
||||
each.custody_count = len(custody_ids) |
|
||||
|
|
||||
# count of all custody contracts that are in approved state |
|
||||
@api.multi |
|
||||
def _equipment_count(self): |
|
||||
for each in self: |
|
||||
equipment_obj = self.env['hr.custody'].search([('employee', '=', each.id), ('state', '=', 'approved')]) |
|
||||
equipment_ids = [] |
|
||||
for each1 in equipment_obj: |
|
||||
if each1.custody_name.id not in equipment_ids: |
|
||||
equipment_ids.append(each1.custody_name.id) |
|
||||
each.equipment_count = len(equipment_ids) |
|
||||
|
|
||||
# smart button action for returning the view of all custody contracts related to the current employee |
|
||||
@api.multi |
|
||||
def custody_view(self): |
|
||||
for each1 in self: |
|
||||
custody_obj = self.env['hr.custody'].search([('employee', '=', each1.id)]) |
|
||||
custody_ids = [] |
|
||||
for each in custody_obj: |
|
||||
custody_ids.append(each.id) |
|
||||
view_id = self.env.ref('hr_custody.hr_custody_form_view').id |
|
||||
if custody_ids: |
|
||||
if len(custody_ids) <= 1: |
|
||||
value = { |
|
||||
'view_type': 'form', |
|
||||
'view_mode': 'form', |
|
||||
'res_model': 'hr.custody', |
|
||||
'view_id': view_id, |
|
||||
'type': 'ir.actions.act_window', |
|
||||
'name': _('Custody'), |
|
||||
'res_id': custody_ids and custody_ids[0] |
|
||||
} |
|
||||
else: |
|
||||
value = { |
|
||||
'domain': str([('id', 'in', custody_ids)]), |
|
||||
'view_type': 'form', |
|
||||
'view_mode': 'tree,form', |
|
||||
'res_model': 'hr.custody', |
|
||||
'view_id': False, |
|
||||
'type': 'ir.actions.act_window', |
|
||||
'name': _('Custody'), |
|
||||
'res_id': custody_ids |
|
||||
} |
|
||||
|
|
||||
return value |
|
||||
|
|
||||
# smart button action for returning the view of all custody contracts that are in approved state, |
|
||||
# related to the current employee |
|
||||
@api.multi |
|
||||
def equipment_view(self): |
|
||||
for each1 in self: |
|
||||
equipment_obj = self.env['hr.custody'].search([('employee', '=', each1.id), ('state', '=', 'approved')]) |
|
||||
equipment_ids = [] |
|
||||
for each in equipment_obj: |
|
||||
if each.custody_name.id not in equipment_ids: |
|
||||
equipment_ids.append(each.custody_name.id) |
|
||||
view_id = self.env.ref('hr_custody.custody_custody_form_view').id |
|
||||
if equipment_ids: |
|
||||
if len(equipment_ids) <= 1: |
|
||||
value = { |
|
||||
'view_type': 'form', |
|
||||
'view_mode': 'form', |
|
||||
'res_model': 'custody.property', |
|
||||
'view_id': view_id, |
|
||||
'type': 'ir.actions.act_window', |
|
||||
'name': _('Equipments'), |
|
||||
'res_id': equipment_ids and equipment_ids[0] |
|
||||
} |
|
||||
else: |
|
||||
value = { |
|
||||
'domain': str([('id', 'in', equipment_ids)]), |
|
||||
'view_type': 'form', |
|
||||
'view_mode': 'tree,form', |
|
||||
'res_model': 'custody.property', |
|
||||
'view_id': False, |
|
||||
'type': 'ir.actions.act_window', |
|
||||
'name': _('Equipments'), |
|
||||
'res_id': equipment_ids |
|
||||
} |
|
||||
|
|
||||
return value |
|
@ -1,48 +0,0 @@ |
|||||
# -*- 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>). |
|
||||
# Authors: Avinash Nk, Jesni Banu (<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/>. |
|
||||
# |
|
||||
################################################################################### |
|
||||
from odoo import models, fields, api, _ |
|
||||
|
|
||||
|
|
||||
class WizardReason(models.TransientModel): |
|
||||
""" |
|
||||
Hr custody contract refuse wizard. |
|
||||
""" |
|
||||
_name = 'wizard.reason' |
|
||||
|
|
||||
@api.multi |
|
||||
def send_reason(self): |
|
||||
context = self._context |
|
||||
reject_obj = self.env[context.get('model_id')].search([('id', '=', context.get('reject_id'))]) |
|
||||
if 'renew' in context.keys(): |
|
||||
reject_obj.write({'state': 'approved', |
|
||||
'renew_reject': True, |
|
||||
'renew_rejected_reason': self.reason}) |
|
||||
else: |
|
||||
if context.get('model_id') == 'hr.holidays': |
|
||||
reject_obj.write({'rejected_reason': self.reason}) |
|
||||
reject_obj.action_refuse() |
|
||||
else: |
|
||||
reject_obj.write({'state': 'rejected', |
|
||||
'rejected_reason': self.reason}) |
|
||||
|
|
||||
reason = fields.Text(string="Reason") |
|
@ -1,23 +0,0 @@ |
|||||
# -*- 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>). |
|
||||
# Authors: Avinash Nk, Jesni Banu (<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/>. |
|
||||
# |
|
||||
################################################################################### |
|
||||
from . import custody_report |
|
@ -1,84 +0,0 @@ |
|||||
# -*- 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>). |
|
||||
# Authors: Avinash Nk, Jesni Banu (<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/>. |
|
||||
# |
|
||||
################################################################################### |
|
||||
from odoo import models, fields, tools |
|
||||
|
|
||||
|
|
||||
class CustodyHistory(models.Model): |
|
||||
_name = "report.custody" |
|
||||
_description = "Custody Analysis" |
|
||||
_auto = False |
|
||||
|
|
||||
name = fields.Char(string='Code') |
|
||||
date_request = fields.Date(string='Requested Date') |
|
||||
employee = fields.Many2one('hr.employee', string='Employee') |
|
||||
purpose = fields.Char(string='Reason') |
|
||||
custody_name = fields.Many2one('custody.property', string='Custody Name') |
|
||||
return_date = fields.Date(string='Return Date') |
|
||||
renew_date = fields.Date(string='Renewal Return Date') |
|
||||
renew_return_date = fields.Boolean(string='Renewal Return Date') |
|
||||
state = fields.Selection([('draft', 'Draft'), ('to_approve', 'Waiting For Approval'), ('approved', 'Approved'), |
|
||||
('returned', 'Returned'), ('rejected', 'Refused')], string='Status') |
|
||||
|
|
||||
_order = 'name desc' |
|
||||
|
|
||||
def _select(self): |
|
||||
select_str = """ |
|
||||
SELECT |
|
||||
(select 1 ) AS nbr, |
|
||||
t.id as id, |
|
||||
t.name as name, |
|
||||
t.date_request as date_request, |
|
||||
t.employee as employee, |
|
||||
t.purpose as purpose, |
|
||||
t.custody_name as custody_name, |
|
||||
t.return_date as return_date, |
|
||||
t.renew_date as renew_date, |
|
||||
t.renew_return_date as renew_return_date, |
|
||||
t.state as state |
|
||||
""" |
|
||||
return select_str |
|
||||
|
|
||||
def _group_by(self): |
|
||||
group_by_str = """ |
|
||||
GROUP BY |
|
||||
t.id, |
|
||||
name, |
|
||||
date_request, |
|
||||
employee, |
|
||||
purpose, |
|
||||
custody_name, |
|
||||
return_date, |
|
||||
renew_date, |
|
||||
renew_return_date, |
|
||||
state |
|
||||
""" |
|
||||
return group_by_str |
|
||||
|
|
||||
def init(self): |
|
||||
tools.sql.drop_view_if_exists(self._cr, 'report_custody') |
|
||||
self._cr.execute(""" |
|
||||
CREATE view report_custody as |
|
||||
%s |
|
||||
FROM hr_custody t |
|
||||
%s |
|
||||
""" % (self._select(), self._group_by())) |
|
@ -1,27 +0,0 @@ |
|||||
<?xml version="1.0" encoding="utf-8" ?> |
|
||||
<odoo> |
|
||||
<data> |
|
||||
<record id="view_report_custody" model="ir.ui.view"> |
|
||||
<field name="name">report.custody.pivot</field> |
|
||||
<field name="model">report.custody</field> |
|
||||
<field name="arch" type="xml"> |
|
||||
<pivot string="Ticket Analysis" display_quantity="true" disable_linking="True"> |
|
||||
<field name="name" type="row"/> |
|
||||
</pivot> |
|
||||
</field> |
|
||||
</record> |
|
||||
|
|
||||
<record id="action_report_custody" model="ir.actions.act_window"> |
|
||||
<field name="name">Custody Analysis</field> |
|
||||
<field name="res_model">report.custody</field> |
|
||||
<field name="view_type">form</field> |
|
||||
<field name="view_mode">pivot</field> |
|
||||
<field name="context">{'group_by_no_leaf':1,'group_by':[]}</field> |
|
||||
<field name="help">This report allows you to analyse all Custody Requests. </field> |
|
||||
</record> |
|
||||
|
|
||||
<menuitem name="Custody Analysis" action="action_report_custody" id="menu_custody_analysis" |
|
||||
groups="hr.group_hr_manager" |
|
||||
parent="hr_employee_updation.employee_report_menu" sequence="1"/> |
|
||||
</data> |
|
||||
</odoo> |
|
@ -1,16 +0,0 @@ |
|||||
<?xml version="1.0" ?> |
|
||||
<odoo> |
|
||||
<record id="property_rule_custody" model="ir.rule"> |
|
||||
<field name="name">Custody Multi Company</field> |
|
||||
<field name="model_id" ref="model_custody_property"/> |
|
||||
<field eval="True" name="global"/> |
|
||||
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field> |
|
||||
</record> |
|
||||
|
|
||||
<record id="property_rule_custody_req" model="ir.rule"> |
|
||||
<field name="name">Custody Request Multi Company</field> |
|
||||
<field name="model_id" ref="model_hr_custody"/> |
|
||||
<field eval="True" name="global"/> |
|
||||
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field> |
|
||||
</record> |
|
||||
</odoo> |
|
|
Before Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 113 KiB |
Before Width: | Height: | Size: 119 KiB |
Before Width: | Height: | Size: 95 KiB |
Before Width: | Height: | Size: 221 KiB |
Before Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 30 KiB |
@ -1,111 +0,0 @@ |
|||||
|
|
||||
<section class="oe_container oe_dark"> |
|
||||
<div class="oe_row oe_spaced"> |
|
||||
<h2 class="oe_slogan">Open HRMS</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> |
|
||||
</div> |
|
||||
</div> |
|
||||
</section> |
|
||||
|
|
||||
|
|
||||
<section class="oe_container oe_dark"> |
|
||||
<div class="oe_row oe_spaced"> |
|
||||
<h2 class="oe_slogan">Open HRMS Custody Management</h2> |
|
||||
<h3 class="oe_slogan">Manages Custody Handling Process</h3> |
|
||||
<h4 class="oe_slogan"><a href="https://www.cybrosys.com">Cybrosys Technologies</a> </h4> |
|
||||
</div> |
|
||||
<div class="oe_row oe_spaced" style="padding-left:65px;"> |
|
||||
<h4>Features:</h4> |
|
||||
<div> |
|
||||
<span style="color:green;"> ☑ </span> Managing custody handling process.<br/> |
|
||||
<span style="color:green;"> ☑ </span> Option to renewal.<br/> |
|
||||
<span style="color:green;"> ☑ </span> Option to take reports.<br/> |
|
||||
</div> |
|
||||
</div> |
|
||||
</section> |
|
||||
|
|
||||
<section class="oe_container "> |
|
||||
<div class="oe_row oe_spaced"> |
|
||||
<div class="oe_picture"> |
|
||||
<h3 class="oe_slogan">Overview</h3> |
|
||||
<p class="oe_mt32 text-justify" style="text-align: center;"> |
|
||||
Blues over resource tracking? No more worries. |
|
||||
OHRMS Custody Management system constitutes the ultimate |
|
||||
solution for a transparent custody of company resources. |
|
||||
</p> |
|
||||
</div> |
|
||||
</div> |
|
||||
</section> |
|
||||
|
|
||||
<section class="oe_container oe_dark"> |
|
||||
<div class="oe_row oe_spaced"> |
|
||||
<h4 class="oe_slogan">Custody Request</h4> |
|
||||
<div class="oe_span12"> |
|
||||
<p class='oe_mt32'> |
|
||||
☛ Create a Custody Request.<br> |
|
||||
☛ Send for Approval.<br> |
|
||||
</p> |
|
||||
<div class="oe_row_img oe_centered"> |
|
||||
<img class="oe_picture oe_screenshot" src="custody_request.png"> |
|
||||
</div> |
|
||||
</div> |
|
||||
</div> |
|
||||
</section> |
|
||||
|
|
||||
<section class="oe_container "> |
|
||||
<div class="oe_row oe_spaced"> |
|
||||
<h4 class="oe_slogan">Property</h4> |
|
||||
<div class="oe_span12"> |
|
||||
<p class='oe_mt32'> |
|
||||
☛ Create a Property of Company.<br> |
|
||||
<p> |
|
||||
<div class="oe_row_img oe_centered"> |
|
||||
<img class="oe_picture oe_screenshot" src="custody_property.png"> |
|
||||
</div> |
|
||||
</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 oe_dark"> |
|
||||
<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> |
|
||||
|
|
@ -1,222 +0,0 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||
<odoo> |
|
||||
<data> |
|
||||
<record id="seq_hr_custody_seq" model="ir.sequence"> |
|
||||
<field name="name">Custody Code</field> |
|
||||
<field name="code">hr.custody</field> |
|
||||
<field name="prefix">CR</field> |
|
||||
<field eval="4" name="padding" /> |
|
||||
<field eval="False" name="company_id"/> |
|
||||
</record> |
|
||||
|
|
||||
<record model='ir.ui.view' id='wizard_return_date_form'> |
|
||||
<field name="name">wizard.return.date.form</field> |
|
||||
<field name="model">wizard.return.date</field> |
|
||||
<field name="arch" type="xml"> |
|
||||
<form string="Renewal Request"> |
|
||||
<group> |
|
||||
<group> |
|
||||
<field name="returned_date"/> |
|
||||
</group> |
|
||||
</group> |
|
||||
<footer> |
|
||||
<button name="proceed" string="Proceed" type="object" class="oe_highlight"/> |
|
||||
or |
|
||||
<button string="Cancel" class="oe_link" special="cancel" /> |
|
||||
</footer> |
|
||||
</form> |
|
||||
</field> |
|
||||
</record> |
|
||||
|
|
||||
<record model='ir.ui.view' id='custody_custody_form_view'> |
|
||||
<field name="name">custody.property.form</field> |
|
||||
<field name="model">custody.property</field> |
|
||||
<field name="arch" type="xml"> |
|
||||
<form string="Equipments"> |
|
||||
<sheet> |
|
||||
<field name="image" widget='image' class="oe_avatar" options='{"preview_image": "image_medium"}'/> |
|
||||
<div class="oe_title"> |
|
||||
<h1><field name="name" placeholder="Name"/></h1> |
|
||||
</div> |
|
||||
<group> |
|
||||
<group> |
|
||||
<field name="company_id" options="{'no_create': True}" groups="base.group_multi_company"/> |
|
||||
</group> |
|
||||
<group></group> |
|
||||
</group> |
|
||||
<notebook> |
|
||||
<page name="desc" string="Description"> |
|
||||
<field name="desc"/> |
|
||||
</page> |
|
||||
</notebook> |
|
||||
</sheet> |
|
||||
</form> |
|
||||
</field> |
|
||||
</record> |
|
||||
|
|
||||
<record model='ir.actions.act_window' id='wizard_return_date_act'> |
|
||||
<field name="name">Custody Request</field> |
|
||||
<field name="res_model">wizard.return.date</field> |
|
||||
<field name="view_type">form</field> |
|
||||
<field name="view_mode">form</field> |
|
||||
<field name="view_id" ref="wizard_return_date_form"/> |
|
||||
<field name="target">new</field> |
|
||||
</record> |
|
||||
|
|
||||
<record id="hr_custody_form_view" model="ir.ui.view"> |
|
||||
<field name="name">hr.custody.form</field> |
|
||||
<field name="model">hr.custody</field> |
|
||||
<field name="arch" type="xml"> |
|
||||
<form string="Custody"> |
|
||||
<header> |
|
||||
<button string="Send For Approval" type="object" name="sent" |
|
||||
attrs="{'invisible': [('state','not in',('draft'))]}"/> |
|
||||
<button string="Approve" groups="hr.group_hr_manager" type="object" name="approve" |
|
||||
attrs="{'invisible': ['|',('state','not in',('to_approve')), |
|
||||
('renew_return_date','=',True)]}"/> |
|
||||
<button string="Renewal Approval" groups="hr.group_hr_manager" type="object" name="renew_approve" |
|
||||
attrs="{'invisible': ['|',('state','not in',('to_approve')), |
|
||||
('renew_return_date','=',False)]}"/> |
|
||||
<button string="Refuse" groups="hr.group_hr_manager" type="action" name="%(hr_custody.wizard_reason_act)d" |
|
||||
attrs="{'invisible': ['|',('state','not in',('to_approve')), |
|
||||
('renew_return_date','=',True)]}" class="btn-primary" context="{'reject_id':id,'model_id':'hr.custody'}"/> |
|
||||
<button class="btn-primary" name="%(hr_custody.wizard_reason_act)d" string="Refuse" groups="hr.group_hr_manager" type="action" |
|
||||
attrs="{'invisible': ['|',('state','not in',('to_approve')), |
|
||||
('renew_return_date','=',False)]}" context="{'reject_id':id,'model_id':'hr.custody','renew': 'renew'}"/> |
|
||||
<button string="Set to Draft" type="object" name="set_to_draft" |
|
||||
attrs="{'invisible': [('state','not in',('rejected'))]}"/> |
|
||||
<button string="Return" type="object" name="set_to_return" groups="hr.group_hr_manager" |
|
||||
attrs="{'invisible': [('state','not in',('approved'))]}"/> |
|
||||
<button string="Send Mail" type="object" name="send_mail" groups="hr.group_hr_manager" |
|
||||
attrs="{'invisible': ['|',('mail_send', '=', False),('state','not in',('approved'))]}"/> |
|
||||
<button string="Send Mail" type="object" class="oe_highlight" name="send_mail" groups="hr.group_hr_manager" |
|
||||
attrs="{'invisible': ['|',('mail_send', '=', True),('state','not in',('approved'))]}"/> |
|
||||
<button string="Renew" type="action" name="%(wizard_return_date_act)d" |
|
||||
context="{'custody_id':id}" |
|
||||
attrs="{'invisible': ['|',('state','not in',('approved')), |
|
||||
('renew_return_date','=',True)]}"/> |
|
||||
<field name="state" widget="statusbar" statusbar_visible="draft,to_approve,approved,returned"/> |
|
||||
</header> |
|
||||
<sheet> |
|
||||
<h1> |
|
||||
<field name="name" readonly="1" nolabel="1"/> |
|
||||
</h1> |
|
||||
<group> |
|
||||
<group> |
|
||||
<field name="custody_name" options="{'no_open':True,'no_create':True}" |
|
||||
domain="[('company_id','child_of',[company_id])]"/> |
|
||||
<field name="renew_return_date" invisible="1"/> |
|
||||
<field name="renew_reject" invisible="1"/> |
|
||||
<field name="mail_send" invisible="1"/> |
|
||||
<field name="employee"/> |
|
||||
<field name="purpose"/> |
|
||||
</group> |
|
||||
<group> |
|
||||
<field name="date_request"/> |
|
||||
<field name="return_date" attrs="{'invisible': [('renew_return_date','=',True), |
|
||||
('renew_date','not in',[None,False]),('renew_reject','=',False)]}"/> |
|
||||
<field name="renew_date" attrs="{'invisible': ['|',('renew_return_date','=',False), |
|
||||
('state','!=','to_approve')]}"/> |
|
||||
<field name="rejected_reason" attrs="{'invisible': [('state','not in',('rejected'))]}"/> |
|
||||
<field name="renew_rejected_reason" attrs="{'invisible': ['|',('renew_reject','=',False),('state','not in',('approved'))]}"/> |
|
||||
<field name="company_id" options="{'no_create': True}" groups="base.group_multi_company"/> |
|
||||
</group> |
|
||||
</group> |
|
||||
<notebook> |
|
||||
<page string="Notes"> |
|
||||
<field name="notes"/> |
|
||||
</page> |
|
||||
</notebook> |
|
||||
</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 id="hr_custody_tree_view" model="ir.ui.view"> |
|
||||
<field name="name">hr.custody.tree</field> |
|
||||
<field name="model">hr.custody</field> |
|
||||
<field name="arch" type="xml"> |
|
||||
<tree decoration-info="state == 'draft'" colors="red:current_date > return_date;grey:state == 'rejected';green:state == 'approved'; |
|
||||
black:state == 'to_approve';grey:state == 'returned';"> |
|
||||
<field name="name"/> |
|
||||
<field name="custody_name"/> |
|
||||
<field name="employee"/> |
|
||||
<field name="purpose"/> |
|
||||
<field name="date_request"/> |
|
||||
<field name="return_date"/> |
|
||||
<field name="state"/> |
|
||||
</tree> |
|
||||
</field> |
|
||||
</record> |
|
||||
|
|
||||
<record id="hr_property_tree_view" model="ir.ui.view"> |
|
||||
<field name="name">hr_property_tree_view.tree</field> |
|
||||
<field name="model">custody.property</field> |
|
||||
<field name="arch" type="xml"> |
|
||||
<tree> |
|
||||
<field name="name"/> |
|
||||
</tree> |
|
||||
</field> |
|
||||
</record> |
|
||||
|
|
||||
<record id="hr_custody_search_view" model="ir.ui.view"> |
|
||||
<field name="name">hr.custody.search</field> |
|
||||
<field name="model">hr.custody</field> |
|
||||
<field name="arch" type="xml"> |
|
||||
<search string="Custody"> |
|
||||
<field name="name"/> |
|
||||
<field name="custody_name"/> |
|
||||
<field name="employee"/> |
|
||||
<field name="purpose"/> |
|
||||
<field name="date_request"/> |
|
||||
<field name="return_date"/> |
|
||||
<field name="state"/> |
|
||||
<separator/> |
|
||||
<group expand="0" string="Group By"> |
|
||||
<filter string="Status" domain="[]" context="{'group_by':'state'}"/> |
|
||||
<filter string="Employee" domain="[]" context="{'group_by':'employee'}"/> |
|
||||
<filter string="Custody Name" domain="[]" context="{'group_by':'custody_name'}"/> |
|
||||
</group> |
|
||||
</search> |
|
||||
</field> |
|
||||
</record> |
|
||||
|
|
||||
<record id="action_hr_custody" model="ir.actions.act_window"> |
|
||||
<field name="name">Custody</field> |
|
||||
<field name="res_model">hr.custody</field> |
|
||||
<field name="view_type">form</field> |
|
||||
<field name="view_mode">tree,form</field> |
|
||||
<field name="search_view_id" ref="hr_custody_search_view"/> |
|
||||
<field name="help" type="html"> |
|
||||
<p class="oe_view_nocontent_create"> |
|
||||
Click to Create a New Record. |
|
||||
</p> |
|
||||
</field> |
|
||||
</record> |
|
||||
|
|
||||
<record id="action_hr_property" model="ir.actions.act_window"> |
|
||||
<field name="name">Property</field> |
|
||||
<field name="res_model">custody.property</field> |
|
||||
<field name="view_type">form</field> |
|
||||
<field name="view_mode">tree,form</field> |
|
||||
<field name="help" type="html"> |
|
||||
<p class="oe_view_nocontent_create"> |
|
||||
Click to Create a New Record. |
|
||||
</p> |
|
||||
</field> |
|
||||
</record> |
|
||||
|
|
||||
<menuitem id="hr_custody_main_menu" parent="hr.menu_hr_root" |
|
||||
name="Custody Management" sequence="20"/> |
|
||||
|
|
||||
<menuitem action="action_hr_custody" id="hr_custody_menu" parent="hr_custody.hr_custody_main_menu" |
|
||||
name="Custody Request" sequence="1"/> |
|
||||
|
|
||||
<menuitem action="action_hr_property" id="hr_property_menu" parent="hr_custody.hr_custody_main_menu" |
|
||||
name="Property" sequence="5" groups="hr.group_hr_user"/> |
|
||||
</data> |
|
||||
</odoo> |
|
@ -1,15 +0,0 @@ |
|||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||
<odoo> |
|
||||
<data> |
|
||||
<record model="ir.cron" id="hr_custody_data_reminder"> |
|
||||
<field name="name">HR Custody Return Notification</field> |
|
||||
<field name="interval_number">1</field> |
|
||||
<field name="interval_type">days</field> |
|
||||
<field name="numbercall">-1</field> |
|
||||
<field name="doall" eval="False"/> |
|
||||
<field name="model" eval="'hr.custody'"/> |
|
||||
<field name="function" eval="'mail_reminder'"/> |
|
||||
<field name="args" eval="'()'" /> |
|
||||
</record> |
|
||||
</data> |
|
||||
</odoo> |
|
@ -1,20 +0,0 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||
<odoo> |
|
||||
<data> |
|
||||
<record model="ir.ui.view" id="custody_hr_employee_inherit_form_view"> |
|
||||
<field name="name">hr.employee.form.inherit.view</field> |
|
||||
<field name="model">hr.employee</field> |
|
||||
<field name="inherit_id" ref="hr.view_employee_form"/> |
|
||||
<field name="arch" type="xml"> |
|
||||
<div class="oe_button_box" position="inside"> |
|
||||
<button class="oe_stat_button" name="custody_view" type="object" icon="fa-list-ol"> |
|
||||
<field string="Custody" name="custody_count" widget="statinfo"/> |
|
||||
</button> |
|
||||
<button class="oe_stat_button" name="equipment_view" type="object" icon="fa-tablet"> |
|
||||
<field string="Equipments" name="equipment_count" widget="statinfo"/> |
|
||||
</button> |
|
||||
</div> |
|
||||
</field> |
|
||||
</record> |
|
||||
</data> |
|
||||
</odoo> |
|
@ -1,24 +0,0 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||
<odoo> |
|
||||
<data> |
|
||||
<record id="custody_email_notification_template" model="mail.template"> |
|
||||
<field name="name">Custody e-mail template</field> |
|
||||
<field name="email_from">${object.company_id and object.company_id.email or ''}</field> |
|
||||
<field name="subject">Notification to return company asset-${object.custody_name.name}</field> |
|
||||
<field name="email_to">${object.email|safe}</field> |
|
||||
<field name="lang">${object.lang}</field> |
|
||||
<field name="model_id" ref="hr_custody.model_hr_custody"/> |
|
||||
<field name="auto_delete" eval="True"/> |
|
||||
<field name="body_html"> |
|
||||
<![CDATA[ |
|
||||
<p>Dear ${(object.employee.name)},<br/><br/> |
|
||||
You are in possession of the company asset |
|
||||
<strong>"${(object.custody_name.name)}"</strong> |
|
||||
since <strong>${(object.return_date)}.</strong><br/><br/> |
|
||||
Please kindly return the property as soon as possible.<br/><br/></p> |
|
||||
Regards,<br/><br/> |
|
||||
${(object.company_id.name)}]]> |
|
||||
</field> |
|
||||
</record> |
|
||||
</data> |
|
||||
</odoo> |
|
@ -1,30 +0,0 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||
<odoo> |
|
||||
<data> |
|
||||
<record model='ir.ui.view' id='wizard_reason_form'> |
|
||||
<field name="name">wizard.reason.form</field> |
|
||||
<field name="model">wizard.reason</field> |
|
||||
<field name="arch" type="xml"> |
|
||||
<form string="Update Reason"> |
|
||||
<group> |
|
||||
<field name="reason" required="True"/> |
|
||||
</group> |
|
||||
<footer> |
|
||||
<button name="send_reason" string="Proceed" type="object" class="oe_highlight"/> |
|
||||
or |
|
||||
<button string="Cancel" class="oe_link" special="cancel" /> |
|
||||
</footer> |
|
||||
</form> |
|
||||
</field> |
|
||||
</record> |
|
||||
|
|
||||
<record model='ir.actions.act_window' id='wizard_reason_act'> |
|
||||
<field name="name">Update Reason</field> |
|
||||
<field name="res_model">wizard.reason</field> |
|
||||
<field name="view_type">form</field> |
|
||||
<field name="view_mode">form</field> |
|
||||
<field name="view_id" ref="wizard_reason_form"/> |
|
||||
<field name="target">new</field> |
|
||||
</record> |
|
||||
</data> |
|
||||
</odoo> |
|
@ -1,43 +0,0 @@ |
|||||
OHRMS Employee Shift v10 |
|
||||
======================== |
|
||||
|
|
||||
Easily create, manage, and track employee shift schedules |
|
||||
|
|
||||
Depends |
|
||||
======= |
|
||||
[hr] addon Odoo |
|
||||
|
|
||||
Tech |
|
||||
==== |
|
||||
* [Python] - Models |
|
||||
* [XML] - Odoo views |
|
||||
|
|
||||
Installation |
|
||||
============ |
|
||||
- www.odoo.com/documentation/10.0/setup/install.html |
|
||||
- Install our custom addon |
|
||||
|
|
||||
License |
|
||||
======= |
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE, Version 3 (LGPLv3) |
|
||||
(http://www.gnu.org/licenses/agpl.html) |
|
||||
|
|
||||
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: Saritha Sahadevan, saritha@cybrosys.in |
|
||||
|
|
||||
Maintainer |
|
||||
---------- |
|
||||
|
|
||||
This module is maintained by Cybrosys Technologies. |
|
||||
|
|
||||
For support and more information, please visit https://www.cybrosys.com. |
|
@ -1,6 +0,0 @@ |
|||||
## Module hr_employee_shift |
|
||||
|
|
||||
#### 30.03.2018 |
|
||||
#### Version 10.0.1.0.0 |
|
||||
##### ADD |
|
||||
- Initial commit for OpenHrms Project |
|
@ -1,23 +0,0 @@ |
|||||
# -*- 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: Saritha Sahadevan (<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/>. |
|
||||
# |
|
||||
################################################################################### |
|
||||
from . import models |
|
@ -1,46 +0,0 @@ |
|||||
# -*- coding: utf-8 -*- |
|
||||
################################################################################### |
|
||||
# A part of Open Hrms Project <https://www.openhrms.com> |
|
||||
# |
|
||||
# Cybrosys Technologies Pvt. Ltd. |
|
||||
# Copyright (C) 2018-TODAY Cybrosys Technologies (<https://www.cybrosys.com>). |
|
||||
# Author: Saritha Sahadevan (<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': "Open HRMS Employee Shift", |
|
||||
'version': '10.0.1.0', |
|
||||
'summary': """Easily create, manage, and track employee shift schedules.""", |
|
||||
'description': """Easily create, manage, and track employee shift schedules.""", |
|
||||
'category': 'Human Resource', |
|
||||
'author': 'Cybrosys Techno Solutions', |
|
||||
'company': 'Cybrosys Techno Solutions', |
|
||||
'maintainer': 'Cybrosys Techno Solutions', |
|
||||
'website': "https://www.openhrms.com", |
|
||||
'depends': ['hr', 'hr_payroll'], |
|
||||
'data': [ |
|
||||
'security/ir.model.access.csv', |
|
||||
'security/hr_employee_shift_security.xml', |
|
||||
'views/hr_employee_shift_view.xml', |
|
||||
'views/hr_employee_contract_view.xml', |
|
||||
'views/hr_generate_shift_view.xml', |
|
||||
'views/templates.xml', |
|
||||
], |
|
||||
'images': ["static/description/banner.jpg"], |
|
||||
'license': "AGPL-3", |
|
||||
'installable': True, |
|
||||
'application': True, |
|
||||
} |
|
@ -1,23 +0,0 @@ |
|||||
# -*- 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: Saritha Sahadevan (<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/>. |
|
||||
# |
|
||||
################################################################################### |
|
||||
from . import hr_employee_shift, hr_employee_contract, hr_generate_shift, hr_shift_payroll |
|
@ -1,75 +0,0 @@ |
|||||
# -*- 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: Saritha Sahadevan (<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/>. |
|
||||
# |
|
||||
################################################################################### |
|
||||
from odoo.exceptions import Warning |
|
||||
from odoo import models, fields, api, _ |
|
||||
|
|
||||
|
|
||||
class HrEmployeeContract(models.Model): |
|
||||
_inherit = 'hr.contract' |
|
||||
|
|
||||
shift_schedule = fields.One2many('hr.shift.schedule', 'rel_hr_schedule', string="Shift Schedule") |
|
||||
working_hours = fields.Many2one('resource.calendar', string='Working Schedule') |
|
||||
department_id = fields.Many2one('hr.department', string="Department", required=True) |
|
||||
|
|
||||
|
|
||||
class HrSchedule(models.Model): |
|
||||
_name = 'hr.shift.schedule' |
|
||||
|
|
||||
start_date = fields.Date(string="Date From", required=True) |
|
||||
end_date = fields.Date(string="Date To", required=True) |
|
||||
rel_hr_schedule = fields.Many2one('hr.contract') |
|
||||
hr_shift = fields.Many2one('resource.calendar', string="Shift", required=True) |
|
||||
|
|
||||
@api.onchange('start_date', 'end_date') |
|
||||
def get_department(self): |
|
||||
"""Adding domain to the hr_shift field""" |
|
||||
hr_department = None |
|
||||
if self.start_date: |
|
||||
hr_department = self.rel_hr_schedule.department_id.id |
|
||||
return { |
|
||||
'domain': { |
|
||||
'hr_shift': [('hr_department', '=', hr_department)] |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
@api.multi |
|
||||
def write(self, vals): |
|
||||
self._check_overlap(vals) |
|
||||
return super(HrSchedule, self).write(vals) |
|
||||
|
|
||||
@api.model |
|
||||
def create(self, vals): |
|
||||
self._check_overlap(vals) |
|
||||
return super(HrSchedule, self).create(vals) |
|
||||
|
|
||||
def _check_overlap(self, vals): |
|
||||
if vals.get('start_date', False) and vals.get('end_date', False): |
|
||||
shifts = self.env['hr.shift.schedule'].search([('rel_hr_schedule', '=', vals.get('rel_hr_schedule'))]) |
|
||||
for each in shifts: |
|
||||
if each != shifts[-1]: |
|
||||
if each.end_date >= vals.get('start_date') or each.start_date >= vals.get('start_date'): |
|
||||
raise Warning(_('The dates may not overlap with one another.')) |
|
||||
if vals.get('start_date') > vals.get('end_date'): |
|
||||
raise Warning(_('Start date should be less than end date.')) |
|
||||
return True |
|
||||
|
|
@ -1,41 +0,0 @@ |
|||||
# -*- 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: Saritha Sahadevan (<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/>. |
|
||||
# |
|
||||
################################################################################### |
|
||||
from odoo.exceptions import ValidationError |
|
||||
from odoo import models, fields, api |
|
||||
|
|
||||
|
|
||||
class HrEmployeeShift(models.Model): |
|
||||
_inherit = 'resource.calendar' |
|
||||
|
|
||||
color = fields.Integer(string='Color Index') |
|
||||
hr_department = fields.Many2one('hr.department', string="Department", required=True) |
|
||||
sequence = fields.Integer(string="Sequence", required=True, default=1) |
|
||||
|
|
||||
@api.constrains('sequence') |
|
||||
def validate_seq(self): |
|
||||
record = self.env['resource.calendar'].search([('hr_department', '=', self.hr_department.id), |
|
||||
('sequence', '=', self.sequence) |
|
||||
]) |
|
||||
if len(record) > 1: |
|
||||
raise ValidationError("One record with same sequence is already active." |
|
||||
"You can't activate more than one record at a time") |
|
@ -1,101 +0,0 @@ |
|||||
# -*- 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: Saritha Sahadevan (<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/>. |
|
||||
# |
|
||||
################################################################################### |
|
||||
from odoo import models, fields |
|
||||
|
|
||||
|
|
||||
class HrGenerateShift(models.Model): |
|
||||
_name = 'hr.shift.generate' |
|
||||
|
|
||||
hr_department = fields.Many2one('hr.department', string="Department") |
|
||||
start_date = fields.Date(string="Start Date", required=True) |
|
||||
end_date = fields.Date(string="End Date", required=True) |
|
||||
|
|
||||
def action_schedule_shift(self): |
|
||||
"""Create mass schedule for all departments based on the shift scheduled in corresponding employee's contract""" |
|
||||
|
|
||||
if self.hr_department: |
|
||||
for contract in self.env['hr.contract'].search([('department_id', '=', self.hr_department.id)]): |
|
||||
if contract.shift_schedule: |
|
||||
for shift_val in contract.shift_schedule: |
|
||||
shift = shift_val.hr_shift |
|
||||
start_date = self.start_date |
|
||||
end_date = self.end_date |
|
||||
shift_obj = self.env['resource.calendar'].search([('hr_department', '=', self.hr_department.id), |
|
||||
('name', '=', shift.name)], limit=1) |
|
||||
sequence = shift_obj.sequence |
|
||||
seq_no = sequence + 1 |
|
||||
new_shift = self.env['resource.calendar'].search([ |
|
||||
('sequence', '=', seq_no), ('hr_department', '=', self.hr_department.id)], limit=1) |
|
||||
if new_shift: |
|
||||
shift_ids = [(0, 0, { |
|
||||
'hr_shift': new_shift.id, |
|
||||
'start_date': start_date, |
|
||||
'end_date': end_date |
|
||||
})] |
|
||||
contract.shift_schedule = shift_ids |
|
||||
else: |
|
||||
seq_no = 1 |
|
||||
new_shift = self.env['resource.calendar'].search([ |
|
||||
('sequence', '=', seq_no), ('hr_department', '=', self.hr_department.id)], limit=1) |
|
||||
if new_shift: |
|
||||
shift_ids = [(0, 0, { |
|
||||
'hr_shift': new_shift.id, |
|
||||
'start_date': start_date, |
|
||||
'end_date': end_date |
|
||||
})] |
|
||||
contract.shift_schedule = shift_ids |
|
||||
else: |
|
||||
for contract in self.env['hr.contract'].search([]): |
|
||||
if contract.shift_schedule and contract.department_id: |
|
||||
for shift_val in contract.shift_schedule: |
|
||||
shift = shift_val.hr_shift |
|
||||
start_date = self.start_date |
|
||||
end_date = self.end_date |
|
||||
shift_obj = self.env['resource.calendar'].search([('hr_department', '=', contract.department_id.id), |
|
||||
('name', '=', shift.name)], limit=1) |
|
||||
sequence = shift_obj.sequence |
|
||||
seq_no = sequence + 1 |
|
||||
new_shift = self.env['resource.calendar'].search([ |
|
||||
('sequence', '=', seq_no), ('hr_department', '=', contract.department_id.id)], limit=1) |
|
||||
if new_shift: |
|
||||
shift_ids = [(0, 0, { |
|
||||
'hr_shift': new_shift.id, |
|
||||
'start_date': start_date, |
|
||||
'end_date': end_date |
|
||||
})] |
|
||||
contract.shift_schedule = shift_ids |
|
||||
else: |
|
||||
seq_no = 1 |
|
||||
new_shift = self.env['resource.calendar'].search([ |
|
||||
('sequence', '=', seq_no), ('hr_department', '=', contract.department_id.id)], limit=1) |
|
||||
shift_ids = [(0, 0, { |
|
||||
'hr_shift': new_shift.id, |
|
||||
'start_date': start_date, |
|
||||
'end_date': end_date |
|
||||
})] |
|
||||
contract.shift_schedule = shift_ids |
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
@ -1,109 +0,0 @@ |
|||||
# -*- 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: Saritha Sahadevan (<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/>. |
|
||||
# |
|
||||
################################################################################### |
|
||||
from datetime import datetime, timedelta |
|
||||
from odoo import models, fields, api, _, tools |
|
||||
|
|
||||
|
|
||||
class HrPayroll(models.Model): |
|
||||
_inherit = 'hr.payslip' |
|
||||
|
|
||||
@api.model |
|
||||
def get_worked_day_lines(self, contract_ids, date_from, date_to): |
|
||||
""" |
|
||||
@param contract_ids: list of contract id |
|
||||
@return: returns a list of dict containing the input that should be applied for the given contract between date_from and date_to |
|
||||
""" |
|
||||
|
|
||||
def was_on_leave_interval(employee_id, date_from, date_to): |
|
||||
date_from = fields.Datetime.to_string(date_from) |
|
||||
date_to = fields.Datetime.to_string(date_to) |
|
||||
return self.env['hr.holidays'].search([ |
|
||||
('state', '=', 'validate'), |
|
||||
('employee_id', '=', employee_id), |
|
||||
('type', '=', 'remove'), |
|
||||
('date_from', '<=', date_from), |
|
||||
('date_to', '>=', date_to) |
|
||||
], limit=1) |
|
||||
|
|
||||
res = [] |
|
||||
# fill only if the contract as a working schedule linked |
|
||||
uom_day = self.env.ref('product.product_uom_day', raise_if_not_found=False) |
|
||||
for contract in self.env['hr.contract'].browse(contract_ids).filtered(lambda contract: contract): |
|
||||
uom_hour = contract.employee_id.resource_id.calendar_id.uom_id or self.env.ref('product.product_uom_hour', |
|
||||
raise_if_not_found=False) |
|
||||
interval_data = [] |
|
||||
holidays = self.env['hr.holidays'] |
|
||||
attendances = { |
|
||||
'name': _("Normal Working Days paid at 100%"), |
|
||||
'sequence': 1, |
|
||||
'code': 'WORK100', |
|
||||
'number_of_days': 0.0, |
|
||||
'number_of_hours': 0.0, |
|
||||
'contract_id': contract.id, |
|
||||
} |
|
||||
leaves = {} |
|
||||
|
|
||||
# Gather all intervals and holidays |
|
||||
for days in contract.shift_schedule: |
|
||||
start_date = datetime.strptime(days.start_date, tools.DEFAULT_SERVER_DATE_FORMAT) |
|
||||
end_date = datetime.strptime(days.end_date, tools.DEFAULT_SERVER_DATE_FORMAT) |
|
||||
|
|
||||
nb_of_days = (end_date - start_date).days + 1 |
|
||||
for day in range(0, nb_of_days): |
|
||||
|
|
||||
working_intervals_on_day = days.hr_shift.get_working_intervals_of_day( |
|
||||
start_dt=start_date + timedelta(days=day)) |
|
||||
for interval in working_intervals_on_day: |
|
||||
interval_data.append( |
|
||||
(interval, was_on_leave_interval(contract.employee_id.id, interval[0], interval[1]))) |
|
||||
|
|
||||
# Extract information from previous data. A working interval is considered: |
|
||||
# - as a leave if a hr.holiday completely covers the period |
|
||||
# - as a working period instead |
|
||||
for interval, holiday in interval_data: |
|
||||
holidays |= holiday |
|
||||
hours = (interval[1] - interval[0]).total_seconds() / 3600.0 |
|
||||
if holiday: |
|
||||
# if he was on leave, fill the leaves dict |
|
||||
if holiday.holiday_status_id.name in leaves: |
|
||||
leaves[holiday.holiday_status_id.name]['number_of_hours'] += hours |
|
||||
else: |
|
||||
leaves[holiday.holiday_status_id.name] = { |
|
||||
'name': holiday.holiday_status_id.name, |
|
||||
'sequence': 5, |
|
||||
'code': holiday.holiday_status_id.name, |
|
||||
'number_of_days': 0.0, |
|
||||
'number_of_hours': hours, |
|
||||
'contract_id': contract.id, |
|
||||
} |
|
||||
else: |
|
||||
# add the input vals to tmp (increment if existing) |
|
||||
attendances['number_of_hours'] += hours |
|
||||
# Clean-up the results |
|
||||
leaves = [value for key, value in leaves.items()] |
|
||||
for data in [attendances] + leaves: |
|
||||
data['number_of_days'] = uom_hour._compute_quantity(data['number_of_hours'], uom_day) \ |
|
||||
if uom_day and uom_hour \ |
|
||||
else data['number_of_hours'] / 8.0 |
|
||||
res.append(data) |
|
||||
return res |
|
@ -1,16 +0,0 @@ |
|||||
<?xml version="1.0" ?> |
|
||||
<odoo> |
|
||||
<record id="property_rule_hr_shift" model="ir.rule"> |
|
||||
<field name="name">Hr Shift Multi Company</field> |
|
||||
<field name="model_id" ref="model_hr_shift_schedule"/> |
|
||||
<field eval="True" name="global"/> |
|
||||
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field> |
|
||||
</record> |
|
||||
|
|
||||
<record id="property_rule_hr_shift_generate" model="ir.rule"> |
|
||||
<field name="name">Hr Shift Genarate Multi Company</field> |
|
||||
<field name="model_id" ref="model_hr_shift_generate"/> |
|
||||
<field eval="True" name="global"/> |
|
||||
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field> |
|
||||
</record> |
|
||||
</odoo> |
|
|
Before Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 115 KiB |
Before Width: | Height: | Size: 93 KiB |
Before Width: | Height: | Size: 77 KiB |
Before Width: | Height: | Size: 221 KiB |
Before Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 76 KiB |
Before Width: | Height: | Size: 34 KiB |
@ -1,129 +0,0 @@ |
|||||
<section class="oe_container bg-gray-lighter" xmlns="http://www.w3.org/1999/html"> |
|
||||
<div class="oe_row"> |
|
||||
<div class="oe_span"> |
|
||||
<h2 class="oe_slogan">Open HRMS</h2> |
|
||||
<h3 class="oe_slogan">Most advanced open source HR management software</h3> |
|
||||
</div> |
|
||||
</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> |
|
||||
</div> |
|
||||
</div> |
|
||||
</section> |
|
||||
|
|
||||
<section class="oe_container oe_dark"> |
|
||||
<div class="oe_row oe_spaced"> |
|
||||
<div class="oe_span12"> |
|
||||
<h2 class="oe_slogan">Employee Shift Management</h2> |
|
||||
<h3 class="oe_slogan">Easily create, manage, and track employee shift schedules.</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> Define list of Work Shifts</li> |
|
||||
<li style="list-style:none !important;"><span style="color:green;"> ★</span> Define flexible hour wise shift</li> |
|
||||
<li style="list-style:none !important;"><span style="color:green;"> ★</span> Assign shift in employee contract</li> |
|
||||
<li style="list-style:none !important;"><span style="color:green;"> ★</span> Assign new shift automatically</li> |
|
||||
</ul> |
|
||||
</div> |
|
||||
</div> |
|
||||
</section> |
|
||||
|
|
||||
<section class="oe_container"> |
|
||||
<div class="oe_row oe_spaced"> |
|
||||
<div class="oe_picture"> |
|
||||
<h3 class="oe_slogan">Overview</h3> |
|
||||
<p class="oe_mt32"> |
|
||||
Employee Shift Management is a component of Open HRMS suit. |
|
||||
This module allows the user to create and manage employee work shifts. |
|
||||
Administrator can create various shifts according to the working hours and assign the Shift in |
|
||||
employee work contract. The module also helps to automatically assign new shift according to |
|
||||
the shift sequence |
|
||||
</p> |
|
||||
</div> |
|
||||
</div> |
|
||||
</section> |
|
||||
|
|
||||
<section class="oe_container oe_dark"> |
|
||||
<div class="oe_row oe_spaced"> |
|
||||
<div class="oe_span12"> |
|
||||
<p><h2>Create Employee Shift</h2> </p> |
|
||||
<div class="oe_demo oe_picture oe_screenshot"> |
|
||||
<img src="create_shift.png"> |
|
||||
</div> |
|
||||
</div> |
|
||||
</div> |
|
||||
</section> |
|
||||
|
|
||||
<section class="oe_container"> |
|
||||
<div class="oe_row oe_spaced"> |
|
||||
<p><h2>Employee Shift In Contract</h2> </p> |
|
||||
<div class="oe_span6"> |
|
||||
<div class="oe_demo oe_picture oe_screenshot"> |
|
||||
<img src="contract1.png"> |
|
||||
</div> |
|
||||
</div> |
|
||||
<div class="oe_span6"> |
|
||||
<p>Have an option to schedule shift in employee contract form. |
|
||||
It is very important to create atleast one shift schedule manually in contract form</p> |
|
||||
</div> |
|
||||
</div> |
|
||||
</section> |
|
||||
|
|
||||
|
|
||||
<section class="oe_container oe_dark"> |
|
||||
<div class="oe_row oe_spaced"> |
|
||||
<p><h2>Generate Automatic Shifts</h2></p> |
|
||||
<p class="oe_mt32"> |
|
||||
<p>Automatically assign new shift according to the shift sequence</p> |
|
||||
</p> |
|
||||
<div class="oe_span6"> |
|
||||
<div class="oe_demo oe_picture oe_screenshot"> |
|
||||
<img src="generate_schedule.png"> |
|
||||
</div> |
|
||||
</div> |
|
||||
<div class="oe_span6"> |
|
||||
<p><h2> Employee Shifts</h2> </p> |
|
||||
<div class="oe_demo oe_picture oe_screenshot"> |
|
||||
<img src="shift.png"> |
|
||||
</div> |
|
||||
</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> |
|
||||
</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> |
|
||||
|
|
Before Width: | Height: | Size: 99 KiB |
@ -1,7 +0,0 @@ |
|||||
|
|
||||
.style_shift{ |
|
||||
color: black !important; |
|
||||
font-size: 15px; |
|
||||
text-align: center; |
|
||||
padding: 10px 0px 2px 3px; |
|
||||
} |
|
@ -1,18 +0,0 @@ |
|||||
@dashboard-bg-color: white; |
|
||||
|
|
||||
.o_kanban_view.o_kanban_dashboard.o_shift_kanban { |
|
||||
@sale-table-spacing: 20px; |
|
||||
|
|
||||
.o_kanban_record { |
|
||||
min-height: 150px; |
|
||||
max-width: 250px !important; |
|
||||
@media (min-width: @screen-sm-min) { |
|
||||
min-width: 20px; |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
.oe_kanban_content{ |
|
||||
padding-top: 50px!important; |
|
||||
} |
|
||||
|
|
||||
} |
|
@ -1,29 +0,0 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||
<odoo> |
|
||||
<data> |
|
||||
<record id="employee_contract_form_inherited" model="ir.ui.view"> |
|
||||
<field name="name">employee.contract</field> |
|
||||
<field name="model">hr.contract</field> |
|
||||
<field name="inherit_id" ref="hr_contract.hr_contract_view_form"/> |
|
||||
<field name="arch" type="xml"> |
|
||||
<xpath expr="//field[@name='working_hours']" position="replace"> |
|
||||
<field name="working_hours" invisible="1"/> |
|
||||
</xpath> |
|
||||
<xpath expr="//field[@name='department_id']" position="replace"> |
|
||||
<field name="department_id"/> |
|
||||
</xpath> |
|
||||
<xpath expr="//group[@name='duration_group']" position="after"> |
|
||||
<group colspan="2" string="Shift Schedule"> |
|
||||
<field name="shift_schedule" nolabel="1"> |
|
||||
<tree editable="1"> |
|
||||
<field name="start_date"/> |
|
||||
<field name="end_date"/> |
|
||||
<field name="hr_shift"/> |
|
||||
</tree> |
|
||||
</field> |
|
||||
</group> |
|
||||
</xpath> |
|
||||
</field> |
|
||||
</record> |
|
||||
</data> |
|
||||
</odoo> |
|
@ -1,76 +0,0 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||
<odoo> |
|
||||
<data> |
|
||||
<record id="resource_calendar_form" model="ir.ui.view"> |
|
||||
<field name="name">resource.calendar</field> |
|
||||
<field name="model">resource.calendar</field> |
|
||||
<field name="inherit_id" ref="resource.resource_calendar_form"/> |
|
||||
<field name="arch" type="xml"> |
|
||||
<xpath expr="//field[@name='name']" position="after"> |
|
||||
<field name="hr_department"/> |
|
||||
<field name="sequence"/> |
|
||||
<field name="color" invisible="1"/> |
|
||||
</xpath> |
|
||||
</field> |
|
||||
</record> |
|
||||
|
|
||||
<record id="shift_template_kanban_view" model="ir.ui.view"> |
|
||||
<field name="name">employee.shift.kanban</field> |
|
||||
<field name="model">resource.calendar</field> |
|
||||
<field name="arch" type="xml"> |
|
||||
<kanban class="oe_background_grey o_kanban_dashboard o_shift_kanban"> |
|
||||
<field name="color"/> |
|
||||
<templates> |
|
||||
<t t-name="kanban-box"> |
|
||||
<div t-attf-class="oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_card oe_kanban_global_click "> |
|
||||
<div class="o_dropdown_kanban dropdown"> |
|
||||
<a class="dropdown-toggle btn" data-toggle="dropdown" href="#" > |
|
||||
<span class="fa fa-bars fa-lg"/> |
|
||||
</a> |
|
||||
<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel"> |
|
||||
<t t-if="widget.editable"><li><a type="edit">Edit</a></li></t> |
|
||||
<t t-if="widget.deletable"><li><a type="delete">Delete</a></li></t> |
|
||||
<li><ul class="oe_kanban_colorpicker" data-field="color"/></li> |
|
||||
</ul> |
|
||||
</div> |
|
||||
<div class="oe_kanban_content"> |
|
||||
<div class="row"> |
|
||||
<div class="o_primary style_shift"> |
|
||||
<div class="text-center"><strong><field name="name"/></strong></div> |
|
||||
</div> |
|
||||
|
|
||||
</div> |
|
||||
</div> |
|
||||
<div class="oe_kanban_details"> |
|
||||
<strong> |
|
||||
<div class="text-center"> |
|
||||
<span t-if="record.hr_department.value">[<field name="hr_department"/>]</span> |
|
||||
</div> |
|
||||
</strong> |
|
||||
</div> |
|
||||
</div> |
|
||||
</t> |
|
||||
</templates> |
|
||||
</kanban> |
|
||||
</field> |
|
||||
</record> |
|
||||
|
|
||||
<record id="resource.action_resource_calendar_form" model="ir.actions.act_window"> |
|
||||
<field name="name">Shift Working Time</field> |
|
||||
<field name="res_model">resource.calendar</field> |
|
||||
<field name="view_type">form</field> |
|
||||
<field name="view_mode">kanban,tree,form</field> |
|
||||
<field name="view_id" eval="False"/> |
|
||||
<field name="search_view_id" ref="resource.view_resource_calendar_search"/> |
|
||||
<field name="help" type="html"> |
|
||||
<p class="oe_view_nocontent_create"> |
|
||||
Define working hours and time table that could be scheduled to your project members |
|
||||
</p> |
|
||||
</field> |
|
||||
</record> |
|
||||
|
|
||||
<menuitem name="Shifts" id="hr_employee_shift.menu_shift" parent="hr.menu_human_resources_configuration" |
|
||||
action="resource.action_resource_calendar_form"/> |
|
||||
|
|
||||
</data> |
|
||||
</odoo> |
|
@ -1,50 +0,0 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||
|
|
||||
<odoo> |
|
||||
<data> |
|
||||
<!-- explicit wizard view definition --> |
|
||||
<record model="ir.ui.view" id="hr_employee_shift.generate_schedule_form"> |
|
||||
<field name="name">hr_employee_shift_generate_schedule form</field> |
|
||||
<field name="model">hr.shift.generate</field> |
|
||||
<field name="arch" type="xml"> |
|
||||
<form create="false" edit="false"> |
|
||||
<sheet> |
|
||||
<group> |
|
||||
<group> |
|
||||
<field name="hr_department"/> |
|
||||
</group> |
|
||||
</group> |
|
||||
<group> |
|
||||
<group> |
|
||||
<field name="start_date"/> |
|
||||
</group> |
|
||||
<group> |
|
||||
<field name="end_date"/> |
|
||||
</group> |
|
||||
</group> |
|
||||
<footer> |
|
||||
<button string="Generate" name="action_schedule_shift" type="object" |
|
||||
class="oe_highlight"/> |
|
||||
<button string="Cancel" special="cancel" |
|
||||
class="oe_link"/> |
|
||||
</footer> |
|
||||
</sheet> |
|
||||
|
|
||||
</form> |
|
||||
</field> |
|
||||
</record> |
|
||||
|
|
||||
<!-- actions opening views on models --> |
|
||||
<record model="ir.actions.act_window" id="hr_employee_shift.generate_schedule_action_window"> |
|
||||
<field name="name">Employee Shift</field> |
|
||||
<field name="res_model">hr.shift.generate</field> |
|
||||
<field name="view_mode">form</field> |
|
||||
<field name="target">new</field> |
|
||||
</record> |
|
||||
|
|
||||
<!-- menu item --> |
|
||||
<menuitem name="Employee Shift" id="menu_shift_schedule_generate_id_menu" parent="hr.menu_hr_root" action="hr_employee_shift.generate_schedule_action_window" groups="hr.group_hr_manager"/> |
|
||||
<menuitem name="Generate Schedule" id="hr_employee_shift.menu_shift_schedule_generate_id" parent="menu_shift_schedule_generate_id_menu" action="hr_employee_shift.generate_schedule_action_window" groups="hr.group_hr_manager"/> |
|
||||
|
|
||||
</data> |
|
||||
</odoo> |
|
@ -1,9 +0,0 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||
<odoo> |
|
||||
<template id="assets_backend" name="project assets" inherit_id="web.assets_backend"> |
|
||||
<xpath expr="." position="inside"> |
|
||||
<link rel="stylesheet" href="/hr_employee_shift/static/src/css/shift_dashboard.css"/> |
|
||||
<link rel="stylesheet" href="/hr_employee_shift/static/src/less/shift_dashboard.less"/> |
|
||||
</xpath> |
|
||||
</template> |
|
||||
</odoo> |
|
@ -1,39 +0,0 @@ |
|||||
Open HRMS Employee Transfer v10 |
|
||||
=============================== |
|
||||
|
|
||||
Employee transfer between branches. |
|
||||
|
|
||||
Depends |
|
||||
======= |
|
||||
[hr] 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: Sreejith P @ cybrosys, sreejith@cybrosys.in |
|
||||
|
|
||||
Maintainer |
|
||||
---------- |
|
||||
|
|
||||
This module is maintained by Cybrosys Technologies. |
|
||||
|
|
||||
For support and more information, please visit https://www.cybrosys.com. |
|
@ -1,2 +0,0 @@ |
|||||
# -*- coding: utf-8 -*- |
|
||||
from . import models |
|
@ -1,45 +0,0 @@ |
|||||
# -*- coding: utf-8 -*- |
|
||||
################################################################################### |
|
||||
# A part of Open HRMS Project <https://www.openhrms.com> |
|
||||
# |
|
||||
# Cybrosys Technologies Pvt. Ltd. |
|
||||
# Copyright (C) 2018-TODAY Cybrosys Technologies (<https://www.cybrosys.com>). |
|
||||
# Author: Sreejith P (<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': 'Open HRMS Branch Transfer', |
|
||||
'version': '10.0.1.0.0', |
|
||||
'summary': 'Employee transfer between branches', |
|
||||
'category': 'Generic Modules/Human Resources', |
|
||||
'author': 'Cybrosys Techno solutions', |
|
||||
'maintainer': 'Cybrosys Techno Solutions', |
|
||||
'company': 'Cybrosys Techno Solutions', |
|
||||
'website': 'https://www.openhrms.com', |
|
||||
'depends': ['base', |
|
||||
'hr_employee_updation' |
|
||||
], |
|
||||
'data': [ |
|
||||
'views/employee_transfer.xml', |
|
||||
'security/ir.model.access.csv', |
|
||||
'security/branch_security.xml', |
|
||||
], |
|
||||
'images': ['static/description/banner.jpg'], |
|
||||
'installable': True, |
|
||||
'application': True, |
|
||||
'auto_install': False, |
|
||||
'license': 'AGPL-3', |
|
||||
} |
|
@ -1,6 +0,0 @@ |
|||||
## Module hr_employee_transfer |
|
||||
|
|
||||
#### 30.03.2018 |
|
||||
#### Version 10.0.1.0.0 |
|
||||
##### ADD |
|
||||
- Initial commit for OpenHrms Project |
|
@ -1,4 +0,0 @@ |
|||||
# -*- coding: utf-8 -*- |
|
||||
from . import employee_transfer |
|
||||
from . import hr_contract |
|
||||
from . import res_company |
|
@ -1,90 +0,0 @@ |
|||||
# -*- coding: utf-8 -*- |
|
||||
from datetime import date |
|
||||
from odoo import models, fields, api, _ |
|
||||
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT |
|
||||
|
|
||||
|
|
||||
class EmployeeTransfer(models.Model): |
|
||||
_name = 'employee.transfer' |
|
||||
_description = 'Employee Transfer' |
|
||||
_order = "id desc" |
|
||||
|
|
||||
def _default_employee(self): |
|
||||
emp_ids = self.env['hr.employee'].search([('user_id', '=', self.env.uid)]) |
|
||||
return emp_ids and emp_ids[0] or False |
|
||||
|
|
||||
name = fields.Char(string='Name', help='Give a name to the Transfer', copy=False, default="/") |
|
||||
employee_id = fields.Many2one('hr.employee', string='Employee', required=True) |
|
||||
date = fields.Date(string='Date', default=fields.Date.today()) |
|
||||
branch = fields.Many2one('transfer.company', string='Transfer Branch', requried=True, copy=False) |
|
||||
state = fields.Selection( |
|
||||
[('draft', 'New'), ('cancel', 'Cancelled'), ('transfer', 'Transferred'), ('done', 'Post')], |
|
||||
string='Status', readonly=True, copy=False, default='draft') |
|
||||
sequence_number = fields.Integer(string='Sequence Number', help='A unique sequence number for the Transfer', |
|
||||
default=1, copy=False) |
|
||||
company_id = fields.Many2one('res.company', string='Company', required=True, |
|
||||
related='employee_id.company_id', store=True) |
|
||||
note = fields.Text(string='Internal Notes') |
|
||||
responsible = fields.Many2one('hr.employee', string='Responsible', default=_default_employee, readonly=True) |
|
||||
|
|
||||
@api.one |
|
||||
def transfer(self): |
|
||||
obj_emp = self.env['hr.employee'].browse(self.employee_id.id) |
|
||||
emp = {} |
|
||||
for this in self: |
|
||||
emp = { |
|
||||
'name': self.employee_id.name, |
|
||||
'company_id': self.branch.company_id, |
|
||||
|
|
||||
} |
|
||||
new_emp = self.env['hr.employee'].create(emp) |
|
||||
if obj_emp.address_home_id: |
|
||||
obj_emp.address_home_id.active = False |
|
||||
for obj_contract in self.env['hr.contract'].search([('employee_id', '=', self.employee_id.id)]): |
|
||||
if obj_contract.date_end: |
|
||||
continue |
|
||||
if not obj_contract.date_end: |
|
||||
obj_contract.write({'date_end': date.today().strftime(DEFAULT_SERVER_DATE_FORMAT)}) |
|
||||
self.wage = obj_contract.wage |
|
||||
self.state = 'transfer' |
|
||||
self.employee_id = new_emp |
|
||||
obj_emp.write({'active': False}) |
|
||||
|
|
||||
@api.multi |
|
||||
def receive_employee(self): |
|
||||
print self.employee_id.company_id.id |
|
||||
for this in self: |
|
||||
if this._context is None: |
|
||||
context = {} |
|
||||
partner = {} |
|
||||
for i in this: |
|
||||
partner = { |
|
||||
'name': i.employee_id.name, |
|
||||
'company_id': i.branch.company_id, |
|
||||
} |
|
||||
partner_created = self.env['res.partner'].create(partner) |
|
||||
self.env['hr.employee'].browse(this.employee_id.id).write({'address_home_id': partner_created.id}) |
|
||||
return { |
|
||||
'name': _('Contract'), |
|
||||
'view_type': 'form', |
|
||||
'view_mode': 'form', |
|
||||
'res_model': 'hr.contract', |
|
||||
'type': 'ir.actions.act_window', |
|
||||
'target': 'current', |
|
||||
'context': {'default_employee_id': this.employee_id.id, |
|
||||
'default_date_start': this.date, |
|
||||
'default_emp_transfer': this.id, |
|
||||
}, |
|
||||
} |
|
||||
|
|
||||
@api.one |
|
||||
def cancel_transfer(self): |
|
||||
obj_emp = self.env['hr.employee'].browse(self.employee_id.id) |
|
||||
emp = { |
|
||||
'name': self.employee_id.name, |
|
||||
'company_id': self.company_id.id, |
|
||||
} |
|
||||
obj_emp.write(emp) |
|
||||
for obj_contract in self.env['hr.contract'].search([('employee_id', '=', self.employee_id.id)]): |
|
||||
obj_contract.unlink() |
|
||||
self.state = 'cancel' |
|
@ -1,16 +0,0 @@ |
|||||
from odoo import models, fields, api |
|
||||
|
|
||||
|
|
||||
class HrContract(models.Model): |
|
||||
_inherit = 'hr.contract' |
|
||||
|
|
||||
company_id = fields.Many2one('res.company', 'Company', default=lambda self: self.env.user.company_id) |
|
||||
from_transfer = fields.Boolean(string='Transferred', default=False) |
|
||||
emp_transfer = fields.Many2one('employee.transfer', string='Transferred Employee') |
|
||||
|
|
||||
@api.model |
|
||||
def create(self, vals): |
|
||||
res = super(HrContract, self).create(vals) |
|
||||
if res.emp_transfer: |
|
||||
self.env['employee.transfer'].browse(res.emp_transfer.id).write({'state': 'done'}) |
|
||||
return res |
|
@ -1,19 +0,0 @@ |
|||||
# -*- coding: utf-8 -*- |
|
||||
from odoo import models, fields, api |
|
||||
|
|
||||
|
|
||||
class HrContract(models.Model): |
|
||||
_inherit = 'hr.employee' |
|
||||
|
|
||||
transfer_detail = fields.One2many('transfer.detail', 'employee_id', string='Transfer Details') |
|
||||
|
|
||||
|
|
||||
class TransferDetails(models.Model): |
|
||||
|
|
||||
_name = 'transfer.detail' |
|
||||
_description = 'Transfer Details' |
|
||||
|
|
||||
employee_id = fields.Many2one('hr.employee', string='Employee') |
|
||||
date = fields.Date(string='Date', copy=False) |
|
||||
company_id = fields.Many2one('res.company', string='Company') |
|
||||
pre_company = fields.Many2one('res.company', string='Previous Company') |
|
@ -1,40 +0,0 @@ |
|||||
# -*- coding: utf-8 -*- |
|
||||
from odoo import models, fields, api |
|
||||
|
|
||||
|
|
||||
class EmployeeTransfer(models.Model): |
|
||||
_name = 'transfer.company' |
|
||||
_description = 'Transfer Company' |
|
||||
_order = "id desc" |
|
||||
|
|
||||
name = fields.Char(string='Name', copy=False, ondelete='cascade') |
|
||||
company_id = fields.Integer(string='Company', help='Company name same as res.company', copy=False) |
|
||||
|
|
||||
|
|
||||
class ResCompany(models.Model): |
|
||||
_inherit = 'res.company' |
|
||||
|
|
||||
def init(self): |
|
||||
obj_company = self.env['res.company'].search([]) |
|
||||
|
|
||||
for company in obj_company: |
|
||||
obj_branch = self.env['transfer.company'].search([('company_id', '=', company.id)]) |
|
||||
com = {} |
|
||||
if not obj_branch: |
|
||||
com = { |
|
||||
'name': company.name, |
|
||||
'company_id': company.id, |
|
||||
} |
|
||||
obj = self.env['transfer.company'].create(com) |
|
||||
|
|
||||
@api.model |
|
||||
def create(self, res): |
|
||||
result = super(ResCompany, self).create(res) |
|
||||
com = {} |
|
||||
com = { |
|
||||
'name': result.name, |
|
||||
'company_id': result.id, |
|
||||
|
|
||||
} |
|
||||
self.env['transfer.company'].create(com) |
|
||||
return result |
|
@ -1,18 +0,0 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||
<odoo> |
|
||||
<data> |
|
||||
<record id="employee_rule" model="ir.rule"> |
|
||||
<field name="name">Employee Rule</field> |
|
||||
<field name="model_id" ref="hr.model_hr_employee"/> |
|
||||
<field name="global" eval="True"/> |
|
||||
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field> |
|
||||
</record> |
|
||||
|
|
||||
<record id="employee_contract_rule" model="ir.rule"> |
|
||||
<field name="name">Contract Rules</field> |
|
||||
<field name="model_id" ref="hr_contract.model_hr_contract"/> |
|
||||
<field name="global" eval="True"/> |
|
||||
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field> |
|
||||
</record> |
|
||||
</data> |
|
||||
</odoo> |
|
|
Before Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 118 KiB |
Before Width: | Height: | Size: 74 KiB |
Before Width: | Height: | Size: 104 KiB |
Before Width: | Height: | Size: 221 KiB |
Before Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 33 KiB |
@ -1,103 +0,0 @@ |
|||||
|
|
||||
<section class="oe_container oe_dark"> |
|
||||
<div class="oe_row oe_spaced"> |
|
||||
<h2 class="oe_slogan">Open HRMS</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> |
|
||||
</div> |
|
||||
</div> |
|
||||
</section> |
|
||||
<section class="oe_container oe_dark"> |
|
||||
<div class="oe_row oe_spaced"> |
|
||||
<h2 class="oe_slogan">Branch Transfer</h2> |
|
||||
<h3 class="oe_slogan">Employee transfer between branches</h3> |
|
||||
<h4 class="oe_slogan"><a href="https://www.cybrosys.com">Cybrosys Technologies</a> </h4> |
|
||||
</div> |
|
||||
<div class="oe_row oe_spaced" style="padding-left:65px;"> |
|
||||
<h4>Features:</h4> |
|
||||
<div> |
|
||||
<span style="color:green;"> ☑ </span> Transfer Employee between branches.<br/> |
|
||||
</div> |
|
||||
</div> |
|
||||
</section> |
|
||||
|
|
||||
<section class="oe_container "> |
|
||||
<div class="oe_row oe_spaced"> |
|
||||
<div class="oe_picture"> |
|
||||
<h3 class="oe_slogan">Overview</h3> |
|
||||
<p class="oe_mt32 text-justify" style="text-align: center;"> |
|
||||
Transferring employees between company is a basic thing in a organization. Now Odoo lacks a provision for employee transfer. This module gives a basic structure for employee transfer |
|
||||
</p> |
|
||||
</div> |
|
||||
</div> |
|
||||
</section> |
|
||||
|
|
||||
<section class="oe_container oe_dark"> |
|
||||
<div class="oe_row oe_spaced"> |
|
||||
<h4 class="oe_slogan">Employee Transfer</h4> |
|
||||
<div class="oe_span12"> |
|
||||
<p class='oe_mt32'> |
|
||||
☛ Create a Employee Transfer.<br> |
|
||||
☛ Select the Transfer Company.<br> |
|
||||
☛ Click on the sent button.<br> |
|
||||
</p> |
|
||||
<div class="oe_row_img oe_centered"> |
|
||||
<img class="oe_picture oe_screenshot" src="create_a_transfer.png"> |
|
||||
</div> |
|
||||
</div> |
|
||||
</div> |
|
||||
</section> |
|
||||
|
|
||||
<section class="oe_container "> |
|
||||
<div class="oe_row oe_spaced"> |
|
||||
<h4 class="oe_slogan">Contract</h4> |
|
||||
<div class="oe_span12"> |
|
||||
<p class='oe_mt32'> |
|
||||
☛ Create new contract.<br> |
|
||||
<p> |
|
||||
<div class="oe_row_img oe_centered"> |
|
||||
<img class="oe_picture oe_screenshot" src="create_contract.png"> |
|
||||
</div> |
|
||||
</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> |
|
||||
|
|
||||
</div> |
|
||||
|
|
||||
<section class="oe_container oe_dark"> |
|
||||
<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> |
|
||||
|
|
@ -1,80 +0,0 @@ |
|||||
<?xml version="1.0" encoding="utf-8" ?> |
|
||||
<odoo> |
|
||||
<record id="employee_transfer" model="ir.ui.view"> |
|
||||
<field name="name">Employee Transfer</field> |
|
||||
<field name="model">employee.transfer</field> |
|
||||
<field name="arch" type="xml"> |
|
||||
<form string="Employee Transfer"> |
|
||||
<header> |
|
||||
<button name="transfer" string="Transfer" class="oe_highlight" type="object" states="draft" |
|
||||
groups="hr.group_hr_manager"/> |
|
||||
<button name="receive_employee" string="Receive" class="oe_highlight" type="object" |
|
||||
groups="hr.group_hr_manager" states="transfer"/> |
|
||||
<button name="cancel_transfer" string="Cancel" type="object" |
|
||||
attrs="{'invisible':[('state','in',('draft', 'cancel'))]}" groups="hr.group_hr_manager"/> |
|
||||
<field name="state" widget="statusbar" statusbar_visible="draft,transfer,done" /> |
|
||||
</header> |
|
||||
<sheet> |
|
||||
<div class="oe_title oe_left"> |
|
||||
<h2> |
|
||||
<field name="name" class="oe_inline" placeholder="Name"/> |
|
||||
</h2> |
|
||||
</div> |
|
||||
<group> |
|
||||
<group> |
|
||||
<field name="employee_id" options="{'no_create': True}" attrs="{'readonly' : [('state', '!=', 'draft')] }"/> |
|
||||
<field name="date" attrs="{'readonly' : [('state', '!=', 'draft')] }"/> |
|
||||
<field name="branch" groups="base.group_multi_company" options="{'no_create': True}" |
|
||||
attrs="{'readonly' : [('state', '!=', 'draft')] }"/> |
|
||||
</group> |
|
||||
<group> |
|
||||
<field name="company_id" groups="base.group_multi_company" options="{'no_create': True}"/> |
|
||||
<field name="responsible" options="{'no_create': True}"/> |
|
||||
</group> |
|
||||
</group> |
|
||||
<notebook colspan="4"> |
|
||||
<page string="Internal Notes" > |
|
||||
<field name="note"/> |
|
||||
</page> |
|
||||
</notebook> |
|
||||
</sheet> |
|
||||
</form> |
|
||||
</field> |
|
||||
</record> |
|
||||
<record id="employee_transfer_tree" model="ir.ui.view"> |
|
||||
<field name="name">Employee Transfer Tree</field> |
|
||||
<field name="model">employee.transfer</field> |
|
||||
<field name="arch" type="xml"> |
|
||||
<tree string="Employee Transfer" decoration-info="state == 'draft'" decoration-muted="state in ('done','cancel')"> |
|
||||
<field name="name"/> |
|
||||
<field name="employee_id"/> |
|
||||
<field name="date"/> |
|
||||
<field name="branch" groups="base.group_multi_company"/> |
|
||||
<!--<field name="amount_total" sum="Amount total" widget="monetary"/>--> |
|
||||
<field name="company_id" groups="base.group_multi_company"/> |
|
||||
<field name="state"/> |
|
||||
</tree> |
|
||||
</field> |
|
||||
</record> |
|
||||
|
|
||||
<record id="action_employee_transfer" model="ir.actions.act_window"> |
|
||||
<field name="name">Employee Transfer</field> |
|
||||
<field name="type">ir.actions.act_window</field> |
|
||||
<field name="res_model">employee.transfer</field> |
|
||||
<field name="view_type">form</field> |
|
||||
<field name="view_mode">tree,form</field> |
|
||||
<field name="view_id" eval="False"/> |
|
||||
<field name="domain">[]</field> |
|
||||
<field name="help" type="html"> |
|
||||
<p class="oe_view_nocontent_create"> |
|
||||
Click to create a new Transfer. |
|
||||
</p><p> |
|
||||
Use this menu to browse previous transfer. To record new |
|
||||
transfer, you may use the create button. |
|
||||
</p> |
|
||||
</field> |
|
||||
</record> |
|
||||
<!--<menuitem id="menu_transfer_root" name="Employee Transfer" parent="hr.menu_hr_root" sequence="2" groups="hr.group_hr_manager"/>--> |
|
||||
<menuitem id="menu_employee_transfer" name="Employee Transfer" parent="hr_employee_updation.menu_hr_management" sequence="3" |
|
||||
action="action_employee_transfer" groups="hr.group_hr_manager"/> |
|
||||
</odoo> |
|
@ -1,17 +0,0 @@ |
|||||
Open HRMS Employee Info |
|
||||
----------------------- |
|
||||
Supporting Addon for Open HRMS, Added Advanced Fields On Employee Master. |
|
||||
|
|
||||
Connect with experts |
|
||||
-------------------- |
|
||||
|
|
||||
If you have any question/queries/additional works on OpenHRMS or this module, You can drop an email directly to Cybrosys. |
|
||||
|
|
||||
Contacts |
|
||||
-------- |
|
||||
info - info@cybrosys.com |
|
||||
Jesni Banu - jesni@cybrosys.in |
|
||||
|
|
||||
Website: |
|
||||
https://www.openhrms.com |
|
||||
https://www.cybrosys.com |
|
@ -1,25 +0,0 @@ |
|||||
# -*- 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: Jesni Banu (<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/>. |
|
||||
# |
|
||||
################################################################################### |
|
||||
from . import models |
|
||||
|
|
||||
|
|
@ -1,44 +0,0 @@ |
|||||
# -*- 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: Jesni Banu (<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': 'Open HRMS Employee Info', |
|
||||
'version': '10.0.1.1.0', |
|
||||
'summary': """Adding Advanced Fields In Employee Master""", |
|
||||
'description': 'This module helps you to add more information in employee records.', |
|
||||
'category': 'Generic Modules/Human Resources', |
|
||||
'author': 'Cybrosys Techno Solutions', |
|
||||
'company': 'Cybrosys Techno Solutions', |
|
||||
'website': "https://www.openhrms.com", |
|
||||
'depends': ['base', 'hr', 'mail', 'hr_gamification'], |
|
||||
'data': [ |
|
||||
'security/ir.model.access.csv', |
|
||||
'views/hr_employee_view.xml', |
|
||||
'views/hr_notification.xml', |
|
||||
], |
|
||||
'demo': [], |
|
||||
'images': ['static/description/banner.jpg'], |
|
||||
'license': 'AGPL-3', |
|
||||
'installable': True, |
|
||||
'auto_install': False, |
|
||||
'application': False, |
|
||||
} |
|
@ -1,11 +0,0 @@ |
|||||
## Module <hr_employee_updation> |
|
||||
|
|
||||
#### 07.04.2018 |
|
||||
#### Version 10.0.1.1.0 |
|
||||
##### CHG |
|
||||
- Index updated. |
|
||||
|
|
||||
#### 30.03.2018 |
|
||||
#### Version 10.0.1.0.0 |
|
||||
##### ADD |
|
||||
- Initial commit for Open HRMS Project |
|
@ -1,27 +0,0 @@ |
|||||
# -*- 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: Jesni Banu (<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/>. |
|
||||
# |
|
||||
################################################################################### |
|
||||
from . import hr_employee |
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
@ -1,107 +0,0 @@ |
|||||
# -*- 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: Jesni Banu (<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/>. |
|
||||
# |
|
||||
################################################################################### |
|
||||
from datetime import datetime, timedelta |
|
||||
from odoo import models, fields, _ |
|
||||
|
|
||||
GENDER_SELECTION = [('male', 'Male'), |
|
||||
('female', 'Female'), |
|
||||
('other', 'Other')] |
|
||||
|
|
||||
|
|
||||
class HrEmployeeContractName(models.Model): |
|
||||
"""This class is to add emergency contact table""" |
|
||||
_name = 'hr.emergency.contact' |
|
||||
_description = 'HR Emergency Contact' |
|
||||
|
|
||||
number = fields.Char(string='Number', help='Contact Number') |
|
||||
relation = fields.Char(string='Contact', help='Relation with employee') |
|
||||
employee_obj = fields.Many2one('hr.employee', invisible=1) |
|
||||
|
|
||||
|
|
||||
class HrEmployeeFamilyInfo(models.Model): |
|
||||
"""Table for keep employee family information""" |
|
||||
_name = 'hr.employee.family' |
|
||||
_description = 'HR Employee Family' |
|
||||
|
|
||||
member_name = fields.Char(string='Name', related='employee_ref.name', store=True) |
|
||||
employee_ref = fields.Many2one(string="Is Employee", |
|
||||
help='If family member currently is an employee of same company, ' |
|
||||
'then please tick this field', |
|
||||
comodel_name='hr.employee') |
|
||||
employee_id = fields.Many2one(string="Employee", help='Select corresponding Employee', comodel_name='hr.employee', |
|
||||
invisible=1) |
|
||||
relation = fields.Selection([('father', 'Father'), |
|
||||
('mother', 'Mother'), |
|
||||
('daughter', 'Daughter'), |
|
||||
('son', 'Son'), |
|
||||
('wife', 'Wife')], string='Relationship', help='Relation with employee') |
|
||||
member_contact = fields.Char(string='Contact No', related='employee_ref.personal_mobile', store=True) |
|
||||
|
|
||||
|
|
||||
class HrEmployee(models.Model): |
|
||||
_inherit = 'hr.employee' |
|
||||
|
|
||||
def mail_reminder(self): |
|
||||
now = datetime.now() + timedelta(days=1) |
|
||||
date_now = now.date() |
|
||||
match = self.search([]) |
|
||||
for i in match: |
|
||||
if i.id_expiry_date: |
|
||||
exp_date = fields.Date.from_string(i.id_expiry_date) - timedelta(days=14) |
|
||||
if date_now >= exp_date: |
|
||||
mail_content = " Hello " + i.name + ",<br>Your ID " + i.identification_id + "is going to expire on " + \ |
|
||||
str(i.id_expiry_date) + ". Please renew it before expiry date" |
|
||||
main_content = { |
|
||||
'subject': _('ID-%s Expired On %s') % (i.identification_id, i.id_expiry_date), |
|
||||
'author_id': self.env.user.partner_id.id, |
|
||||
'body_html': mail_content, |
|
||||
'email_to': i.work_email, |
|
||||
} |
|
||||
self.env['mail.mail'].create(main_content).send() |
|
||||
match1 = self.search([]) |
|
||||
for i in match1: |
|
||||
if i.passport_expiry_date: |
|
||||
exp_date1 = fields.Date.from_string(i.passport_expiry_date) - timedelta(days=180) |
|
||||
if date_now >= exp_date1: |
|
||||
mail_content = " Hello " + i.name + ",<br>Your Passport " + i.passport_id + "is going to expire on " + \ |
|
||||
str(i.passport_expiry_date) + ". Please renew it before expiry date" |
|
||||
main_content = { |
|
||||
'subject': _('Passport-%s Expired On %s') % (i.passport_id, i.passport_expiry_date), |
|
||||
'author_id': self.env.user.partner_id.id, |
|
||||
'body_html': mail_content, |
|
||||
'email_to': i.work_email, |
|
||||
} |
|
||||
self.env['mail.mail'].create(main_content).send() |
|
||||
personal_mobile = fields.Char(string='Mobile', related='address_home_id.mobile', store=True) |
|
||||
emergency_contact = fields.One2many('hr.emergency.contact', 'employee_obj', string='Emergency Contact') |
|
||||
joining_date = fields.Date(string='Joining Date') |
|
||||
id_expiry_date = fields.Date(string='Expiry Date', help='Expiry date of Identification ID') |
|
||||
passport_expiry_date = fields.Date(string='Expiry Date', help='Expiry date of Passport ID') |
|
||||
id_attachment_id = fields.Many2many('ir.attachment', 'id_attachment_rel', 'id_ref', 'attach_ref', |
|
||||
string="Attachment", help='You can attach the copy of your Id') |
|
||||
passport_attachment_id = fields.Many2many('ir.attachment', 'passport_attachment_rel', 'passport_ref', 'attach_ref1', |
|
||||
string="Attachment", |
|
||||
help='You can attach the copy of Passport') |
|
||||
fam_ids = fields.One2many('hr.employee.family', 'employee_id', string='Family', help='Family Information') |
|
||||
|
|
||||
|
|
|
Before Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 109 KiB |
Before Width: | Height: | Size: 221 KiB |
Before Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 31 KiB |
@ -1,127 +0,0 @@ |
|||||
<section class="oe_container"> |
|
||||
<div class="oe_row"> |
|
||||
<h2 class="oe_slogan"><a href="https://www.openhrms.com">Open HRMS</a></h2> |
|
||||
<h3 class="oe_slogan">Most advanced open source HR management software</h3> |
|
||||
</div> |
|
||||
</section> |
|
||||
|
|
||||
<section class="oe_container oe_dark"> |
|
||||
<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"> |
|
||||
<h2 class="oe_slogan">Open HRMS Employee Info</h2> |
|
||||
<h3 class="oe_slogan">Added Advance Fields On Employee Master</h3> |
|
||||
<h4 class="oe_slogan"><a href="https://www.cybrosys.com">Cybrosys Technologies</a> </h4> |
|
||||
</div> |
|
||||
<div class="oe_row oe_spaced" style="padding-left:65px;"> |
|
||||
<h4>Features:</h4> |
|
||||
<div> |
|
||||
<span style="color:green;"> ☑ </span> Added family information.<br/> |
|
||||
<span style="color:green;"> ☑ </span> Added joining date and contact info.<br/> |
|
||||
<span style="color:green;"> ☑ </span> Added passport and id expiry date and attachments.<br/> |
|
||||
<span style="color:green;"> ☑ </span> Added expiry notification for passport and id documents.<br/> |
|
||||
</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 text-justify" style="text-align: center;"> |
|
||||
This module added some advanced features on Employee master. |
|
||||
Such as family info, joining date, passport and Id expiry date. |
|
||||
This module also sends expiry notification for passport and id to corresponding employees. |
|
||||
</p> |
|
||||
</div> |
|
||||
</div> |
|
||||
</section> |
|
||||
|
|
||||
<section class="oe_container"> |
|
||||
<div class="oe_row oe_spaced"> |
|
||||
<h4 class="oe_slogan">Identification ID & Passport ID</h4> |
|
||||
<div class="oe_span12"> |
|
||||
<div class="oe_row_img oe_centered"> |
|
||||
<img class="oe_picture oe_screenshot" src="personal_info.png"> |
|
||||
</div> |
|
||||
</div> |
|
||||
</div> |
|
||||
</section> |
|
||||
|
|
||||
<section class="oe_container oe_dark"> |
|
||||
<div class="oe_row oe_spaced"> |
|
||||
<h4 class="oe_slogan">Emergency Contact Number</h4> |
|
||||
<div class="oe_span12"> |
|
||||
<div class="oe_row_img oe_centered"> |
|
||||
<img class="oe_picture oe_screenshot" src="emergency_contact.png"> |
|
||||
</div> |
|
||||
</div> |
|
||||
</div> |
|
||||
</section> |
|
||||
|
|
||||
<section class="oe_container"> |
|
||||
<div class="oe_row oe_spaced"> |
|
||||
<h4 class="oe_slogan">Family Information</h4> |
|
||||
<div class="oe_span12"> |
|
||||
<div class="oe_row_img oe_centered"> |
|
||||
<img class="oe_picture oe_screenshot" src="family_info.png"> |
|
||||
</div> |
|
||||
</div> |
|
||||
</div> |
|
||||
</section> |
|
||||
|
|
||||
<section class="oe_container oe_dark"> |
|
||||
<div class="oe_row oe_spaced"> |
|
||||
<h4 class="oe_slogan">Joining Date</h4> |
|
||||
<div class="oe_span12"> |
|
||||
<div class="oe_row_img oe_centered"> |
|
||||
<img class="oe_picture oe_screenshot" src="joining_date.png"> |
|
||||
</div> |
|
||||
</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> |
|
||||
|
|
||||
|
|
Before Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 55 KiB |
@ -1,84 +0,0 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||
<odoo> |
|
||||
<data> |
|
||||
<menuitem id="employee_report_menu" name="Reports" parent="hr.menu_hr_root" sequence="30" |
|
||||
groups="hr.group_hr_manager,hr.group_hr_user"/> |
|
||||
<menuitem id="menu_hr_management" name="HR Management" parent="hr.menu_hr_root" sequence="5" |
|
||||
groups="hr.group_hr_manager,hr.group_hr_user"/> |
|
||||
<record model="ir.ui.view" id="hr_employee_inherit_form_view"> |
|
||||
<field name="name">hr.employee.form.view</field> |
|
||||
<field name="model">hr.employee</field> |
|
||||
<field name="inherit_id" ref="hr.view_employee_form"/> |
|
||||
<field name="arch" type="xml"> |
|
||||
<xpath expr="//page[@name='personal_information']/group" position="inside"> |
|
||||
<group name="emergency_contact" colspan="4" string="Emergency Contact"> |
|
||||
<field name="emergency_contact"> |
|
||||
<tree editable="bottom"> |
|
||||
<field name="number"/> |
|
||||
<field name="relation"/> |
|
||||
</tree> |
|
||||
</field> |
|
||||
</group> |
|
||||
</xpath> |
|
||||
<field name="address_home_id" position="after"> |
|
||||
<field name="personal_mobile"/> |
|
||||
</field> |
|
||||
<field name="user_id" position="after"> |
|
||||
<field name="joining_date"/> |
|
||||
</field> |
|
||||
<field name="identification_id" position="replace"/> |
|
||||
<field name="passport_id" position="replace"/> |
|
||||
<xpath expr="//page[@name='personal_information']/group/group[1]" position="after"> |
|
||||
<group name="identification_id" string="Identification ID"> |
|
||||
<field name="identification_id"/> |
|
||||
<field name="id_expiry_date" groups="hr.group_hr_user" attrs="{'invisible': [('identification_id', 'in', [None,False])]}"/> |
|
||||
<field name="id_attachment_id" groups="hr.group_hr_user" widget="many2many_binary" class="oe_inline" attrs="{'invisible': [('identification_id', 'in', [None,False])]}"/> |
|
||||
</group> |
|
||||
<group name="passport_id" string="Passport ID"> |
|
||||
<field name="passport_id"/> |
|
||||
<field name="passport_expiry_date" groups="hr.group_hr_user" attrs="{'invisible': [('passport_id', 'in', [None,False])]}"/> |
|
||||
<field name="passport_attachment_id" groups="hr.group_hr_user" widget="many2many_binary" class="oe_inline" attrs="{'invisible': [('passport_id', 'in', [None,False])]}"/> |
|
||||
</group> |
|
||||
</xpath> |
|
||||
|
|
||||
<page name="hr_settings" position="after"> |
|
||||
<page name="family_info" string="Family Information" groups="hr.group_hr_user"> |
|
||||
<group string="Family"> |
|
||||
<field name="fam_ids" nolabel="1"> |
|
||||
<tree editable="bottom"> |
|
||||
<field name="member_name"/> |
|
||||
<field name="relation"/> |
|
||||
<field name="member_contact"/> |
|
||||
</tree> |
|
||||
</field> |
|
||||
</group> |
|
||||
</page> |
|
||||
</page> |
|
||||
</field> |
|
||||
</record> |
|
||||
|
|
||||
<record id="hr_gamification.hr_hr_employee_view_form" model="ir.ui.view"> |
|
||||
<field name="name">hr.employee.view.form.inherit</field> |
|
||||
<field name="model">hr.employee</field> |
|
||||
<field name="inherit_id" ref="hr.view_employee_form"/> |
|
||||
<field name="arch" type="xml"> |
|
||||
<xpath expr="//page[@name='public']" position="after"> |
|
||||
<page string="Received Badges" attrs="{'invisible': [('user_id', '=', False)]}"> |
|
||||
<div name="badges" groups="hr.group_hr_user"> |
|
||||
<field name="has_badges" invisible="1"/> |
|
||||
<button string="Grant a Badge" type="action" name="%(hr_gamification.action_reward_wizard)d"/> to reward this employee for a good action |
|
||||
<div class="oe_view_nocontent" attrs="{'invisible': [('has_badges', '=', True)]}"> |
|
||||
<p class="oe_view_nocontent_create"> |
|
||||
Click to grant this employee his first badge |
|
||||
</p><p class="oe_grey"> |
|
||||
Badges are rewards of good work. Give them to people you believe deserve it. |
|
||||
</p> |
|
||||
</div> |
|
||||
</div> |
|
||||
<field name="badge_ids" widget="many2many_kanban" /> |
|
||||
</page> |
|
||||
</xpath> |
|
||||
</field> |
|
||||
</record> |
|
||||
</data> |
|
||||
</odoo> |
|
@ -1,15 +0,0 @@ |
|||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||
<odoo> |
|
||||
<data> |
|
||||
<record model="ir.cron" id="employee_data_reminder"> |
|
||||
<field name="name">HR Employee Data Expiration</field> |
|
||||
<field name="interval_number">1</field> |
|
||||
<field name="interval_type">days</field> |
|
||||
<field name="numbercall">-1</field> |
|
||||
<field name="doall" eval="False"/> |
|
||||
<field name="model" eval="'hr.employee'"/> |
|
||||
<field name="function" eval="'mail_reminder'"/> |
|
||||
<field name="args" eval="'()'" /> |
|
||||
</record> |
|
||||
</data> |
|
||||
</odoo> |
|
@ -1,39 +0,0 @@ |
|||||
OHRMS Employee Insurance Management v10 |
|
||||
======================================= |
|
||||
|
|
||||
Employee insurance management for Open HRMS. |
|
||||
|
|
||||
Depends |
|
||||
======= |
|
||||
[hr] 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: Treesa Maria Jude @ cybrosys, treesa@cybrosys.in |
|
||||
|
|
||||
Maintainer |
|
||||
---------- |
|
||||
|
|
||||
This module is maintained by Cybrosys Technologies. |
|
||||
|
|
||||
For support and more information, please visit https://www.cybrosys.com. |
|
@ -1,6 +0,0 @@ |
|||||
## Module hr_insurance |
|
||||
|
|
||||
#### 30.03.2018 |
|
||||
#### Version 10.0.1.0.0 |
|
||||
##### ADD |
|
||||
- Initial commit for OpenHrms Project |
|
@ -1,24 +0,0 @@ |
|||||
# -*- 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: Treesa Maria Jude (<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/>. |
|
||||
# |
|
||||
################################################################################### |
|
||||
|
|
||||
from . import models |
|
@ -1,49 +0,0 @@ |
|||||
# -*- coding: utf-8 -*- |
|
||||
################################################################################### |
|
||||
# A part of Open HRMS Project <https://www.openhrms.com> |
|
||||
# |
|
||||
# Cybrosys Technologies Pvt. Ltd. |
|
||||
# Copyright (C) 2018-TODAY Cybrosys Technologies (<https://www.cybrosys.com>). |
|
||||
# Author: Treesa Maria Jude (<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': 'Open HRMS Employee Insurance Management', |
|
||||
'version': '10.0.1.0.0', |
|
||||
'summary': """Employee Insurance Management for Open HRMS.""", |
|
||||
'description': """Manages insurance amounts for employees to be deducted from salary""", |
|
||||
'category': 'Human Resources', |
|
||||
'author': 'Cybrosys Techno solutions', |
|
||||
'maintainer': 'Cybrosys Techno Solutions', |
|
||||
'company': 'Cybrosys Techno Solutions', |
|
||||
'website': 'https://www.openhrms.com', |
|
||||
'depends': [ |
|
||||
'base', 'hr', 'hr_payroll', |
|
||||
], |
|
||||
'data': [ |
|
||||
'security/ir.model.access.csv', |
|
||||
'security/hr_insurance_security.xml', |
|
||||
'views/employee_insurance_view.xml', |
|
||||
'views/insurance_salary_stucture.xml', |
|
||||
'views/policy_management.xml', |
|
||||
], |
|
||||
'images': ['static/description/banner.jpg'], |
|
||||
'license': 'AGPL-3', |
|
||||
'installable': True, |
|
||||
'auto_install': False, |
|
||||
'application': False, |
|
||||
} |
|
@ -1,25 +0,0 @@ |
|||||
# -*- 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: Treesa Maria Jude (<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/>. |
|
||||
# |
|
||||
################################################################################### |
|
||||
|
|
||||
from . import policy_details |
|
||||
from . import employee_insurance |
|
@ -1,121 +0,0 @@ |
|||||
# -*- 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: Treesa Maria Jude (<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/>. |
|
||||
# |
|
||||
################################################################################### |
|
||||
|
|
||||
import time |
|
||||
from datetime import datetime |
|
||||
from dateutil import relativedelta |
|
||||
from odoo import models, fields, api, _ |
|
||||
|
|
||||
|
|
||||
class EmployeeInsurance(models.Model): |
|
||||
_name = 'hr.insurance' |
|
||||
_description = 'HR Insurance' |
|
||||
_rec_name = 'employee_id' |
|
||||
|
|
||||
employee_id = fields.Many2one('hr.employee', string='Employee', required=True) |
|
||||
policy_id = fields.Many2one('insurance.policy', string='Policy', required=True) |
|
||||
amount = fields.Float(string='Policy Amount', required=True) |
|
||||
sum_insured = fields.Float(string="Sum Insured", required=True) |
|
||||
policy_coverage = fields.Selection([('monthly', 'Monthly'), ('yearly', 'Yearly')], |
|
||||
required=True, default='monthly', |
|
||||
string='Policy Coverage',) |
|
||||
date_from = fields.Date(string='Date From', |
|
||||
default=time.strftime('%Y-%m-%d'), readonly=True) |
|
||||
date_to = fields.Date(string='Date To', readonly=True, |
|
||||
default=str(datetime.now() + relativedelta.relativedelta(months=+1, day=1, days=-1))[:10]) |
|
||||
state = fields.Selection([('active', 'Active'), |
|
||||
('expired', 'Expired'), ], |
|
||||
default='active', string="State",compute='get_status') |
|
||||
company_id = fields.Many2one('res.company', string='Company', required=True, |
|
||||
default=lambda self: self.env.user.company_id) |
|
||||
|
|
||||
def get_status(self): |
|
||||
current_datetime = datetime.now() |
|
||||
for i in self: |
|
||||
x = datetime.strptime(i.date_from, '%Y-%m-%d') |
|
||||
y = datetime.strptime(i.date_to, '%Y-%m-%d') |
|
||||
print x |
|
||||
print current_datetime |
|
||||
print y |
|
||||
if x <= current_datetime and y >= current_datetime: |
|
||||
i.state = 'active' |
|
||||
|
|
||||
else: |
|
||||
i.state = 'expired' |
|
||||
|
|
||||
@api.constrains('policy_coverage') |
|
||||
@api.onchange('policy_coverage') |
|
||||
def get_policy_period(self): |
|
||||
|
|
||||
if self.policy_coverage == 'monthly': |
|
||||
self.date_to = str(datetime.now() + relativedelta.relativedelta(months=+1, day=1, days=-1))[:10] |
|
||||
if self.policy_coverage == 'yearly': |
|
||||
self.date_to = str(datetime.now() + relativedelta.relativedelta(months=+12))[:10] |
|
||||
|
|
||||
|
|
||||
class HrInsurance(models.Model): |
|
||||
_inherit = 'hr.employee' |
|
||||
|
|
||||
insurance_percentage = fields.Float(string="Company Percentage ") |
|
||||
deduced_amount_per_month = fields.Float(string="Salary deduced per month", compute="get_deduced_amount") |
|
||||
deduced_amount_per_year = fields.Float(string="Salary deduced per year", compute="get_deduced_amount") |
|
||||
insurance = fields.One2many('hr.insurance', 'employee_id', string="Insurance", |
|
||||
domain=[('state', '=', 'active')]) |
|
||||
|
|
||||
def get_deduced_amount(self): |
|
||||
current_datetime = datetime.now() |
|
||||
for emp in self: |
|
||||
ins_amount = 0 |
|
||||
for ins in emp.insurance: |
|
||||
|
|
||||
x = datetime.strptime(ins.date_from, '%Y-%m-%d') |
|
||||
y = datetime.strptime(ins.date_to, '%Y-%m-%d') |
|
||||
if x < current_datetime and y > current_datetime: |
|
||||
if ins.policy_coverage == 'monthly': |
|
||||
|
|
||||
ins_amount = ins_amount + (ins.amount*12) |
|
||||
else: |
|
||||
|
|
||||
ins_amount = ins_amount + ins.amount |
|
||||
|
|
||||
emp.deduced_amount_per_year = ins_amount-((ins_amount*emp.insurance_percentage)/100) |
|
||||
emp.deduced_amount_per_month = emp.deduced_amount_per_year/12 |
|
||||
|
|
||||
|
|
||||
class InsuranceRuleInput(models.Model): |
|
||||
_inherit = 'hr.payslip' |
|
||||
|
|
||||
# insurance_amount = fields.Float("Insurance amount", compute='get_inputs') |
|
||||
|
|
||||
def get_inputs(self, contract_ids, date_from, date_to): |
|
||||
"""This Compute the other inputs to employee payslip. |
|
||||
""" |
|
||||
res = super(InsuranceRuleInput, self).get_inputs(contract_ids, date_from, date_to) |
|
||||
|
|
||||
contract_obj = self.env['hr.contract'] |
|
||||
emp_id = contract_obj.browse(contract_ids[0]).employee_id |
|
||||
for result in res: |
|
||||
if emp_id.deduced_amount_per_month != 0 and result.get('code') == 'INSUR': |
|
||||
result['amount'] = emp_id.deduced_amount_per_month |
|
||||
return res |
|
||||
|
|
@ -1,33 +0,0 @@ |
|||||
# -*- 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: Treesa Maria Jude (<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/>. |
|
||||
# |
|
||||
################################################################################### |
|
||||
|
|
||||
from odoo import models, fields, api |
|
||||
|
|
||||
|
|
||||
class InsurancePolicy(models.Model): |
|
||||
_name = 'insurance.policy' |
|
||||
|
|
||||
name = fields.Char(string='Name', required=True) |
|
||||
note_field = fields.Html(string='Comment') |
|
||||
company_id = fields.Many2one('res.company', string='Company', required=True, |
|
||||
default=lambda self: self.env.user.company_id) |
|
@ -1,16 +0,0 @@ |
|||||
<?xml version="1.0" ?> |
|
||||
<odoo> |
|
||||
<record id="property_rule_hr_shift" model="ir.rule"> |
|
||||
<field name="name">Hr Insurancy Company</field> |
|
||||
<field name="model_id" ref="model_hr_insurance"/> |
|
||||
<field eval="True" name="global"/> |
|
||||
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field> |
|
||||
</record> |
|
||||
|
|
||||
<record id="property_rule_hr_shift_generate" model="ir.rule"> |
|
||||
<field name="name">Hr Insurance Policy company</field> |
|
||||
<field name="model_id" ref="model_insurance_policy"/> |
|
||||
<field eval="True" name="global"/> |
|
||||
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field> |
|
||||
</record> |
|
||||
</odoo> |
|