Browse Source

[ADD] Initial Commit

pull/78/head
Sreejith 7 years ago
parent
commit
a61f6e7f0d
  1. 43
      hr_employee_shift/README.rst
  2. 6
      hr_employee_shift/RELEASE_NOTES.md
  3. 23
      hr_employee_shift/__init__.py
  4. 46
      hr_employee_shift/__manifest__.py
  5. 23
      hr_employee_shift/models/__init__.py
  6. 75
      hr_employee_shift/models/hr_employee_contract.py
  7. 41
      hr_employee_shift/models/hr_employee_shift.py
  8. 101
      hr_employee_shift/models/hr_generate_shift.py
  9. 109
      hr_employee_shift/models/hr_shift_payroll.py
  10. 16
      hr_employee_shift/security/hr_employee_shift_security.xml
  11. 3
      hr_employee_shift/security/ir.model.access.csv
  12. BIN
      hr_employee_shift/static/description/HRMS-BUTTON.png
  13. BIN
      hr_employee_shift/static/description/banner.jpg
  14. BIN
      hr_employee_shift/static/description/contract1.png
  15. BIN
      hr_employee_shift/static/description/create_shift.png
  16. BIN
      hr_employee_shift/static/description/cybro-service.png
  17. BIN
      hr_employee_shift/static/description/cybro_logo.png
  18. BIN
      hr_employee_shift/static/description/generate_schedule.png
  19. BIN
      hr_employee_shift/static/description/icon.png
  20. 129
      hr_employee_shift/static/description/index.html
  21. BIN
      hr_employee_shift/static/description/shift.png
  22. 7
      hr_employee_shift/static/src/css/shift_dashboard.css
  23. 18
      hr_employee_shift/static/src/less/shift_dashboard.less
  24. 29
      hr_employee_shift/views/hr_employee_contract_view.xml
  25. 76
      hr_employee_shift/views/hr_employee_shift_view.xml
  26. 50
      hr_employee_shift/views/hr_generate_shift_view.xml
  27. 9
      hr_employee_shift/views/templates.xml

43
hr_employee_shift/README.rst

@ -0,0 +1,43 @@
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.

6
hr_employee_shift/RELEASE_NOTES.md

@ -0,0 +1,6 @@
## Module hr_employee_shift
#### 30.03.2018
#### Version 10.0.1.0.0
##### ADD
- Initial commit for OpenHrms Project

23
hr_employee_shift/__init__.py

@ -0,0 +1,23 @@
# -*- 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

46
hr_employee_shift/__manifest__.py

@ -0,0 +1,46 @@
# -*- coding: utf-8 -*-
###################################################################################
# A part of OpenHrms Project <https://www.openhrms.com>
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2018-TODAY Cybrosys Technologies (<https://www.cybrosys.com>).
# Author: 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': "OHRMS 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,
}

23
hr_employee_shift/models/__init__.py

@ -0,0 +1,23 @@
# -*- 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

75
hr_employee_shift/models/hr_employee_contract.py

@ -0,0 +1,75 @@
# -*- 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

41
hr_employee_shift/models/hr_employee_shift.py

@ -0,0 +1,41 @@
# -*- 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")

101
hr_employee_shift/models/hr_generate_shift.py

@ -0,0 +1,101 @@
# -*- 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

109
hr_employee_shift/models/hr_shift_payroll.py

@ -0,0 +1,109 @@
# -*- 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

16
hr_employee_shift/security/hr_employee_shift_security.xml

@ -0,0 +1,16 @@
<?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>

3
hr_employee_shift/security/ir.model.access.csv

@ -0,0 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_hr_employee_shift_hr_employee_shift,hr_employee_shift.hr_shift_schedule,model_hr_shift_schedule,hr.group_hr_manager,1,1,1,1
access_hr_employee_shift_hr_employee_shift1,hr_employee_shift.hr_shift_generate,model_hr_shift_generate,hr.group_hr_manager,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_hr_employee_shift_hr_employee_shift hr_employee_shift.hr_shift_schedule model_hr_shift_schedule hr.group_hr_manager 1 1 1 1
3 access_hr_employee_shift_hr_employee_shift1 hr_employee_shift.hr_shift_generate model_hr_shift_generate hr.group_hr_manager 1 1 1 1

BIN
hr_employee_shift/static/description/HRMS-BUTTON.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
hr_employee_shift/static/description/banner.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

BIN
hr_employee_shift/static/description/contract1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

BIN
hr_employee_shift/static/description/create_shift.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

BIN
hr_employee_shift/static/description/cybro-service.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 KiB

BIN
hr_employee_shift/static/description/cybro_logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
hr_employee_shift/static/description/generate_schedule.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

BIN
hr_employee_shift/static/description/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

129
hr_employee_shift/static/description/index.html

@ -0,0 +1,129 @@
<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">OpenHRMS</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;"> &#9733;</span>&nbsp;&nbsp; Define list of Work Shifts</li>
<li style="list-style:none !important;"><span style="color:green;"> &#9733;</span>&nbsp;&nbsp; Define flexible hour wise shift</li>
<li style="list-style:none !important;"><span style="color:green;"> &#9733;</span>&nbsp;&nbsp; Assign shift in employee contract</li>
<li style="list-style:none !important;"><span style="color:green;"> &#9733;</span>&nbsp;&nbsp; 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><h1>Create Employee Shift</h1> </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><h1> Employee Shifts</h1> </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>

BIN
hr_employee_shift/static/description/shift.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

7
hr_employee_shift/static/src/css/shift_dashboard.css

@ -0,0 +1,7 @@
.style_shift{
color: black !important;
font-size: 15px;
text-align: center;
padding: 10px 0px 2px 3px;
}

18
hr_employee_shift/static/src/less/shift_dashboard.less

@ -0,0 +1,18 @@
@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;
}
}

29
hr_employee_shift/views/hr_employee_contract_view.xml

@ -0,0 +1,29 @@
<?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>

76
hr_employee_shift/views/hr_employee_shift_view.xml

@ -0,0 +1,76 @@
<?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>

50
hr_employee_shift/views/hr_generate_shift_view.xml

@ -0,0 +1,50 @@
<?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>

9
hr_employee_shift/views/templates.xml

@ -0,0 +1,9 @@
<?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>
Loading…
Cancel
Save