Browse Source

[ADD] Initial Commit

pull/78/head
Sreejith 7 years ago
parent
commit
cef7cd802f
  1. 41
      hrms_dashboard/README.rst
  2. 6
      hrms_dashboard/RELEASE_NOTES.md
  3. 23
      hrms_dashboard/__init__.py
  4. 40
      hrms_dashboard/__manifest__.py
  5. 23
      hrms_dashboard/models/__init__.py
  6. 49
      hrms_dashboard/models/hrms_dashboard.py
  7. BIN
      hrms_dashboard/static/description/HRMS-BUTTON.png
  8. BIN
      hrms_dashboard/static/description/banner.jpg
  9. BIN
      hrms_dashboard/static/description/cybro-service.png
  10. BIN
      hrms_dashboard/static/description/cybro_logo.png
  11. BIN
      hrms_dashboard/static/description/dashboard.png
  12. BIN
      hrms_dashboard/static/description/icon.png
  13. 68
      hrms_dashboard/static/description/index.html
  14. 575
      hrms_dashboard/static/src/css/hrms_dashboard.css
  15. 223
      hrms_dashboard/static/src/js/hrms_dashboard.js
  16. 155
      hrms_dashboard/static/src/xml/hrms_dashboard.xml
  17. 24
      hrms_dashboard/views/dashboard_views.xml

41
hrms_dashboard/README.rst

@ -0,0 +1,41 @@
Open HRMS Dashboard v10
=======================
Keep your eyes on your whole Human resource analysis.
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: Saritha Sahadevan, saritha@cybrosys.in
Maintainer
----------
This module is maintained by Cybrosys Technologies.
For support and more information, please visit https://www.openhrms.com

6
hrms_dashboard/RELEASE_NOTES.md

@ -0,0 +1,6 @@
## Module hrms_dashboard
#### 30.03.2018
#### Version 10.0.1.0.0
##### ADD
- Initial commit for Open HRMS Project

23
hrms_dashboard/__init__.py

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

40
hrms_dashboard/__manifest__.py

@ -0,0 +1,40 @@
# -*- 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: Aswani PC , 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 Dashboard",
'version': '10.0.1.0.0',
'summary': """Open HRMS Dashboard""",
'description': """Open HRMS Dashboard""",
'category': 'Human Resource',
'author': 'Cybrosys Techno Solutions',
'company': 'Cybrosys Techno Solutions',
'maintainer': 'Cybrosys Techno Solutions',
'website': "https://www.openhrms.com",
'depends': ['hr', 'hr_holidays', 'hr_timesheet_sheet', 'hr_recruitment'],
'data': ['views/dashboard_views.xml'],
'qweb': ["static/src/xml/hrms_dashboard.xml"],
'images': ["static/description/banner.gif"],
'license': "AGPL-3",
'installable': True,
'application': True,
}

23
hrms_dashboard/models/__init__.py

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

49
hrms_dashboard/models/hrms_dashboard.py

@ -0,0 +1,49 @@
# -*- 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: Aswani PC, 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, api, _
from odoo.http import request
class Employee(models.Model):
_inherit = 'hr.employee'
@api.model
def get_user_employee_details(self):
uid = request.session.uid
employee = self.env['hr.employee'].sudo().search_read([('user_id', '=', uid)], limit=1)
leaves_to_approve = self.env['hr.holidays'].sudo().search_count([('state', 'in', ['confirm', 'validate1']),
('type', '=', 'remove')])
leaves_alloc_req = self.env['hr.holidays'].sudo().search_count([('state', 'in', ['confirm', 'validate1'])
, ('type', '=', 'add')])
timesheets_to_approve = self.env['hr_timesheet_sheet.sheet'].sudo().search_count(
[('state', 'in', ['confirm'])])
job_applications = self.env['hr.applicant'].sudo().search_count([])
if employee:
data = {
'leaves_to_approve': leaves_to_approve,
'leaves_alloc_req': leaves_alloc_req,
'timesheets_to_approve': timesheets_to_approve,
'job_applications': job_applications,
}
employee[0].update(data)
return employee

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
hrms_dashboard/static/description/banner.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 KiB

BIN
hrms_dashboard/static/description/cybro_logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
hrms_dashboard/static/description/dashboard.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

BIN
hrms_dashboard/static/description/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

68
hrms_dashboard/static/description/index.html

@ -0,0 +1,68 @@
<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">Open HRMS Dashboard</h2>
<h3 class="oe_slogan">Keep your eyes on your whole Human resource analysis</h3>
<h3 class="oe_slogan"><a href="https://www.cybrosys.com">Cybrosys Technologies</a> </h3>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<div class="oe_demo oe_picture oe_screenshot">
<img src="dashboard.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>

575
hrms_dashboard/static/src/css/hrms_dashboard.css

@ -0,0 +1,575 @@
.o_dashboards{
padding-top :15px;
background-color: #f8faff !important;
}
.social-box {
min-height: 160px;
margin-bottom: 1.5rem;
text-align: center;
background: #fff; }
.social-box i {
display: block;
margin: -1px -1px 0;
font-size: 40px;
line-height: 90px;
background: #e9ecef; }
.social-box .chart-wrapper {
height: 90px;
margin: -90px 0 0; }
.social-box .chart-wrapper canvas {
width: 100% !important;
height: 90px !important; }
.social-box ul {
padding: 10px 0;
list-style: none; }
.social-box ul li {
display: block;
float: left;
width: 50%;
padding-top: 10px;
font-size: 18px; }
.social-box ul li:first-child {
border-right: 1px solid #c2cfd6; }
.social-box ul li strong {
display: block;
font-size: 20px; }
.social-box ul li span {
font-size: 18px;
font-weight: 500;
color: #949CA0;
text-transform: uppercase; }
.social-box.facebook i {
color: #fff;
background: #3b5998; }
.social-box.twitter i {
color: #fff;
background: #00aced; }
.social-box.linkedin i {
color: #fff;
background: #4875b4; }
.social-box.google-plus i {
color: #fff;
background: #d34836; }
.content {
float: left;
padding: 0 20px;
width: 100%; }
.card {
padding-top: 0px;
padding: 14px;
margin-bottom: 1.5rem;
border-radius: 10px;
box-shadow: 2px 14px 32px 5px rgba(0, 0, 0, 0.02), 0 3px 13px 0px rgba(0, 0, 0, 0.16);
background-color: #fff;
transition: transform 0.2s ease, box-shadow 0.2s ease;
will-change: transform, box-shadow;
}
.card:hover{
transform: translateY(-5px) translateZ(0);
box-shadow: 0 16px 32px 0 rgba(62,57,107,0.28), 0 0 0 transparent;
}
.card h4 {
font-size: 1.1rem; }
.card .user-header .media img {
border: 5px solid rgba(255, 255, 255, 0.3);
border-radius: 50%;
-webkit-border-radius: 50%; }
.card .card-header .card-actions button {
display: block;
float: left;
width: 50px;
padding: .75rem 0;
margin: 0 !important;
color: #fff;
outline: 0;
text-align: center;
background: transparent;
border: 0;
border-left: 1px solid rgba(120, 130, 140, 0.4); }
.card .card-footer {
padding: 0.65rem 1.25rem;
background-color: #f0f3f5;
border-top: 1px solid #c2cfd6; }
.card .card-footer ul li {
display: table-cell;
padding: 0 1rem;
text-align: center; }
.breadcrumbs {
margin-top: 0; }
/* Tabs */
.nav-tabs a.active {
color: #555;
cursor: default;
background-color: #fff;
border: 1px solid #ddd;
border-bottom-color: transparent; }
.nav-tabs .dropdown .dropdown-menu {
top: 100% !important; }
.custom-tab .nav-tabs > a.active, .custom-tab .nav-tabs > .active > a:focus, .custom-tab .nav-tabs > li.active > a:hover {
border-color: transparent transparent;
color: #ff2e44;
position: relative; }
.custom-tab .nav-tabs > a.active > a:after, .custom-tab .nav-tabs > li.active > a:focus:after, .custom-tab .nav-tabs > li.active > a:hover:after {
background: #ff2e44;
bottom: -1px;
content: "";
height: 2px;
left: 0;
position: absolute;
right: 0;
width: 100%;
z-index: 999; }
.card .card-header .card-actions {
float: right; }
.card .card-header .card-actions [class*="btn"] {
border-left: 1px solid rgba(120, 130, 140, 0.4);
color: #878787;
display: inline-block;
font-size: 16px;
float: left;
padding: 0 7px;
width: inherit;
text-align: center; }
.left-top-card-body {
display: block;
float: left;
position: relative;
}
.left-bottom-card-body{
display: block;
float: left;
position: relative;
}
.social-buttons .card-body p button {
padding-top: 0;
padding-left: 0;
padding-bottom: 0; }
.social-buttons .only-icon .card-body p button {
padding: 0; }
.social-buttons .social i {
padding: 0 10px;
width: inherit !important; }
.social-buttons .only-text p button {
padding: 0 .5rem; }
.buttons button {
margin: 2px 0; }
/* Ribons */
.corner-ribon {
text-align: center;
width: 71px;
height: 71px;
position: absolute;
right: 0;
top: 0;
font-size: 20px; }
.corner-ribon i {
padding: 10px 0 0 35px;
color: #fff; }
/*.black-ribon {*/
/*background: url("../../images/twitter_corner_black.png") no-repeat; }*/
/*.blue-ribon {*/
/*background: url("../../images/twitter_corner_blue.png") no-repeat; }*/
.twt-feed .wtt-mark {
color: rgba(255, 255, 255, 0.15);
font-size: 160px;
position: absolute;
top: 10px;
left: 40%; }
.twt-feed {
-webkit-border-radius: 4px 4px 0 0;
color: #FFFFFF;
padding: 40px 10px 10px;
position: relative;
min-height: 170px; }
.weather-category {
padding: 15px 0;
color: #74829C; }
.weather-category ul li {
width: 32%;
text-align: center;
border-right: 1px solid #e6e6e6;
display: inline-block; }
.twt-feed.blue-bg {
background: #58C9F3; }
.twt-category {
display: inline-block;
margin-bottom: 11px;
margin-top: 10px;
width: 100%; }
.twt-category ul li {
color: #bdbdbd;
font-size: 13px; }
.twt-footer {
padding: 12px 15px; }
.twt-footer, .twt-footer a {
color: #d2d2d2; }
/* Button Reset */
.btn, .button {
display: inline-block;
font-weight: 400;
text-align: center;
white-space: nowrap;
vertical-align: middle;
transition: all .15s ease-in-out;
border-radius: 0;
cursor: pointer; }
/* Icons */
.icon-section {
margin: 0 0 3em;
clear: both;
overflow: hidden; }
.icon-container {
width: 240px;
padding: .7em 0;
float: left;
position: relative;
text-align: left; }
.icon-container [class^="ti-"],
.icon-container [class*=" ti-"] {
color: #000;
position: absolute;
margin-top: 3px;
transition: .3s; }
.icon-container:hover [class^="ti-"],
.icon-container:hover [class*=" ti-"] {
font-size: 2.2em;
margin-top: -5px; }
.icon-container:hover .icon-name {
color: #000; }
.icon-name {
color: #aaa;
margin-left: 35px;
font-size: 14px;
transition: .3s; }
.icon-container:hover .icon-name {
margin-left: 45px; }
.fontawesome-icon-list .page-header {
border-bottom: 1px solid #C9CDD7;
padding-bottom: 9px;
margin: 30px 0px 27px 0px; }
.fontawesome-icon-list h2 {
margin-top: 0;
font-size: 20px;
font-weight: 300; }
.fontawesome-icon-list i {
font-style: italic;
padding-right: 10px; }
.social-box i {
line-height: 110px; }
.social-box ul {
display: inline-block;
margin: 7px 0 0;
padding: 10px;
width: 100%; }
.social-box ul li {
color: #949CA0;
font-size: 14px;
font-weight: 700;
padding: 0 10px 0 0;
text-align: right; }
.social-box ul li:last-child {
padding-left: 10px;
padding-right: 0;
text-align: left; }
.social-box ul li span {
font-size: 14px; }
.login-logo {
text-align: center;
margin-bottom: 15px; }
.login-logo span {
color: #ffffff;
font-size: 24px; }
.login-content {
max-width: 540px;
margin: 8vh auto; }
.login-form {
background: #ffffff;
padding: 30px 30px 20px;
border-radius: 2px; }
.login-form h4 {
color: #878787;
text-align: center;
margin-bottom: 50px; }
.login-form .checkbox {
color: #878787; }
.login-form .checkbox label {
text-transform: none; }
.login-form .btn {
width: 100%;
text-transform: uppercase;
font-size: 14px;
padding: 15px;
border: 0px; }
.login-form label {
color: #878787;
text-transform: uppercase; }
.login-form label a {
color: #ff2e44; }
.social-login-content {
margin: 0px -30px;
border-top: 1px solid #e7e7e7;
border-bottom: 1px solid #e7e7e7;
padding: 30px 0px;
background: #fcfcfc; }
.social-button {
padding: 0 30px; }
.social-button .facebook {
background: #3b5998;
color: #fff; }
.social-button .facebook:hover {
background: #344e86; }
.social-button .twitter {
background: #00aced;
color: #fff; }
.social-button .twitter:hover {
background: #0099d4; }
.social-button i {
padding: 19px; }
.register-link a {
color: #ff2e44; }
.cpu-load {
width: 100%;
height: 272px;
font-size: 14px;
line-height: 1.2em; }
.cpu-load-data-content {
font-size: 18px;
font-weight: 400;
line-height: 40px; }
.cpu-load-data {
margin-bottom: 30px; }
.cpu-load-data li {
display: inline-block;
width: 32.5%;
text-align: center;
border-right: 1px solid #e7e7e7; }
.cpu-load-data li:last-child {
border-right: 0px; }
.nestable-cart {
overflow: hidden; }
/* Forms */
.input-group-addon {
background-color: transparent;
border-left: 0; }
.input-group-addon, .input-group-btn {
white-space: nowrap;
vertical-align: middle; }
.input-group-addon {
padding: .5rem .75rem;
margin-bottom: 0;
font-size: 1rem;
font-weight: 400;
line-height: 1.25;
color: #495057;
text-align: center;
background-color: #e9ecef;
border: 1px solid rgba(0, 0, 0, 0.15);
border-radius: .25rem; }
.flotTip {
background: #252525;
border: 1px solid #252525;
padding: 5px 15px;
color: #ffffff; }
.flot-container {
box-sizing: border-box;
width: 100%;
height: 275px;
padding: 20px 15px 15px;
margin: 15px auto 30px;
background: transparent; }
.flot-pie-container {
height: 275px; }
.flotBar-container {
height: 275px; }
.flot-line {
width: 100%;
height: 100%;
font-size: 14px;
line-height: 1.2em; }
.legend table {
border-spacing: 5px; }
#chart1,
#flotBar,
#flotCurve {
width: 100%;
height: 275px; }
.morris-hover {
position: absolute;
z-index: 1; }
.morris-hover.morris-default-style .morris-hover-row-label {
font-weight: bold;
margin: 0.25em 0; }
.morris-hover.morris-default-style .morris-hover-point {
white-space: nowrap;
margin: 0.1em 0; }
.morris-hover.morris-default-style {
border-radius: 2px;
padding: 10px 12px;
color: #666;
background: rgba(0, 0, 0, 0.7);
border: none;
color: #fff !important; }
.morris-hover-point {
color: rgba(255, 255, 255, 0.8) !important; }
#morris-bar-chart {
height: 285px; }
.map, .vmap {
width: 100%;
height: 400px; }
.btn-toolbar {
float: left !important; }
.btn-toolbar .btn-outline-secondary:not([disabled]):not(.disabled):active,
.btn-toolbar .btn-outline-secondary:not([disabled]):not(.disabled).active,
.btn-toolbar .show > .btn-outline-secondary.dropdown-toggle {
background-color: #212529;
border-color: #212529;
-webkit-box-shadow: none;
box-shadow: none;
color: #fff; }
.btn-toolbar .btn-outline-secondary:hover {
background-color: #212529;
border-color: #212529;
color: #fff; }
/* Widget One
---------------------------*/
.dib {
display: inline-block; }
.stat-widget-one .stat-icon {
vertical-align: top;
margin: auto;
width: 100%;
color: #01c490;
}
.stat-widget-one {
background-color: white;
text-align: center;
}
.stat-widget-one .stat-icon i {
font-size: 30px;
font-weight: 900;
display: inline-block;
color: #01c490;}
.stat-widget-one .stat-text {
font-size: 14px;
color: #868e96; }
.stat-widget-one .stat-digit {
font-size: 24px;
color: #02448b; }
.stat-count {
font-size: 20px;
text-align: center;
color: #00438b;}
.stat-title {
font-size: 17px;
text-align: center;
color: #00438b; }
.bg-flat-color-1 {
background: #20a8d8; }
.bg-flat-color-2 {
background: #63c2de; }
.bg-flat-color-3 {
background: #ffc107; }
.bg-flat-color-4 {
background: #f86c6b; }
.bg-flat-color-5 {
background: #4dbd74; }
.mb-0{
font-size: 20px;
position: relative;
text-align: center;
}
.mb-0 .dash-title {
font-size: 20px;
text-align: center;
color: rgba(255, 255, 255, 0.81);
}
.hr_birthday {
font-size: 28px;
text-align: center;
padding: 20px 0;
color: #00438b;
font-weight: 600;
}
body .text-color {
color: #00438b;
}

223
hrms_dashboard/static/src/js/hrms_dashboard.js

@ -0,0 +1,223 @@
odoo.define('hrms_dashboard.Dashboard', function (require) {
"use strict";
var ajax = require('web.ajax');
var ControlPanelMixin = require('web.ControlPanelMixin');
var core = require('web.core');
var Dialog = require('web.Dialog');
var Model = require('web.Model');
var session = require('web.session');
var utils = require('web.utils');
var web_client = require('web.web_client');
var Widget = require('web.Widget');
var session = require('web.session');
var _t = core._t;
var QWeb = core.qweb;
var HrDashboard = Widget.extend(ControlPanelMixin, {
template: "hrms_dashboard.HrDashboardMain",
events: {
'click .hr_leave_request_approve': 'leaves_to_approve',
'click .hr_leave_allocations_approve': 'leave_allocations_to_approve',
'click .hr_timesheet_approve': 'timesheets_to_approve',
'click .hr_job_application_approve': 'job_applications_to_approve',
'click .hr_payslip':'hr_payslip',
'click .hr_contract':'hr_contract',
'click .hr_employee':'hr_employee',
'click .leaves_request_month':'leaves_request_month',
'click .leaves_request':'leaves_request'
},
init: function(parent, context) {
this._super(parent, context);
this.login_employee = true;
this.employee_birthday = [];
this._super(parent,context);
},
start: function() {
var self = this;
for(var i in self.breadcrumbs){
self.breadcrumbs[i].title = "Dashboard";
}
self.update_control_panel({breadcrumbs: self.breadcrumbs}, {clear: true});
var hr_emp = new Model('hr.employee');
var model = new Model('hr.employee').call('get_user_employee_details').then(function(result){
this.login_employee = result[0];
$('.o_hr_dashboard').html(QWeb.render('ManagerDashboard', {widget: this}));
$('.o_hr_dashboard').prepend(QWeb.render('LoginEmployeeDetails', {widget: this}));
/*need to check user access levels*/
session.user_has_group('hr.group_hr_manager').then(function(has_group){
if(has_group == false){
$('.employee_dashboard_main').css("display", "none");
}
});
});
var today = new Date().toJSON().slice(0,10).replace(/-/g,'/');
var employee = new Model('hr.employee').query(['name', 'birthday','image']).filter([['birthday', '!=', false]])
.order_by('birthday').all().then(function(res){
for (var i = 0; i < res.length; i++) {
var bday_dt = new Date(res[i]['birthday']);
var bday_month = bday_dt.getMonth();
var bday_day = bday_dt.getDate();
var today_dt = new Date( today);
var today_month = today_dt.getMonth();
var today_day = today_dt.getDate();
var day = new Date();
var next_day = new Date(day.setDate(day.getDate() + 7));
var next_week = next_day.toJSON().slice(0,10).replace(/-/g,'/');
var bday_date = bday_dt.toJSON().slice(0,10).replace(/-/g,'/');;
if (bday_month == today_month && bday_day >= today_day && next_week >= bday_date){
self.employee_birthday.push(res[i]);
var flag = 1;
}
}
if (flag !=1){
self.employee_birthday = false;
}
$('.o_hr_birthday_reminder').html(QWeb.render('BirthdayEventDashboard', {widget: self}));
});
return this._super().then(function() {
self.$el.parent().addClass('oe_background_grey');
});
},
hr_payslip: function(e){
var self = this;
e.stopPropagation();
e.preventDefault();
this.do_action({
name: _t("Employee Payslips"),
type: 'ir.actions.act_window',
res_model: 'hr.payslip',
view_mode: 'tree,form,calendar',
view_type: 'form',
views: [[false, 'list'],[false, 'form']],
target: 'current'
})
},
hr_contract: function(e){
var self = this;
e.stopPropagation();
e.preventDefault();
this.do_action({
name: _t("Contracts"),
type: 'ir.actions.act_window',
res_model: 'hr.contract',
view_mode: 'tree,form,calendar',
view_type: 'form',
views: [[false, 'list'],[false, 'form']],
target: 'current'
})
},
leaves_request_month: function(e) {
var self = this;
e.stopPropagation();
e.preventDefault();
var date = new Date();
var firstDay = new Date(date.getFullYear(), date.getMonth(), 1);
var lastDay = new Date(date.getFullYear(), date.getMonth() + 1, 0);
var fday = firstDay.toJSON().slice(0,10).replace(/-/g,'-');
var lday = lastDay.toJSON().slice(0,10).replace(/-/g,'-');
this.do_action({
name: _t("Leave Request"),
type: 'ir.actions.act_window',
res_model: 'hr.holidays',
view_mode: 'tree,form,calendar',
view_type: 'form',
views: [[false, 'list'],[false, 'form']],
domain: [['date_from','>', fday],['state','=','confirm'],['date_from','<', lday]],
target: 'current'
})
},
leaves_request: function(e) {
var self = this;
e.stopPropagation();
e.preventDefault();
this.do_action({
name: _t("Leave Request"),
type: 'ir.actions.act_window',
res_model: 'hr.holidays',
view_mode: 'tree,form,calendar',
view_type: 'form',
views: [[false, 'list'],[false, 'form']],
domain: [['type','=','add']],
target: 'current'
})
},
leaves_to_approve: function(e) {
var self = this;
e.stopPropagation();
e.preventDefault();
this.do_action({
name: _t("Leave Request"),
type: 'ir.actions.act_window',
res_model: 'hr.holidays',
view_mode: 'tree,form,calendar',
view_type: 'form',
views: [[false, 'list'],[false, 'form']],
context: {'search_default_approve': true},
domain: [['type','=','remove'],],
target: 'current'
})
},
leave_allocations_to_approve: function(e) {
var self = this;
e.stopPropagation();
e.preventDefault();
this.do_action({
name: _t("Leave Allocation Request"),
type: 'ir.actions.act_window',
res_model: 'hr.holidays',
view_mode: 'tree,form,calendar',
view_type: 'form',
views: [[false, 'list'],[false, 'form']],
context: {'search_default_approve': true},
domain: [['type','=','add'],],
target: 'current'
})
},
timesheets_to_approve: function(e) {
var self = this;
e.stopPropagation();
e.preventDefault();
this.do_action({
name: _t("Timesheets"),
type: 'ir.actions.act_window',
res_model: 'hr_timesheet_sheet.sheet',
view_mode: 'tree,form',
view_type: 'form',
views: [[false, 'list'],[false, 'form']],
context: {'search_default_to_approve': true},
target: 'current'
})
},
job_applications_to_approve: function(event){
var self = this;
event.stopPropagation();
event.preventDefault();
this.do_action({
name: _t("Applications"),
type: 'ir.actions.act_window',
res_model: 'hr.applicant',
view_mode: 'tree,kanban,form,pivot,graph,calendar',
view_type: 'form',
views: [[false, 'list'],[false, 'kanban'],[false, 'form'],
[false, 'pivot'],[false, 'graph'],[false, 'calendar']],
context: {},
target: 'current'
})
},
});
core.action_registry.add('hr_dashboard', HrDashboard);
return HrDashboard;
});

155
hrms_dashboard/static/src/xml/hrms_dashboard.xml

@ -0,0 +1,155 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-name="hrms_dashboard.HrDashboardMain">
<div class="o_dashboards">
<div class="container-fluid o_hr_dashboard">
</div>
<div class="o_hr_birthday_reminder"></div>
</div>
</t>
<t t-name="ManagerDashboard">
<div class="col-xs-12 employee_dashboard_main">
<div class="col-sm-6 col-lg-6 ">
<div class="col-sm-8 col-lg-8 leaves_request" style="padding:0 !important;">
<div class="card text-color" style="height: 219px;padding-top: 21%;">
<div class="card-body pb-0">
<h4 class="mb-0">
<p class="stat-count"><t t-esc="widget.login_employee.leaves_to_approve"/></p>
</h4>
<p class="stat-title">Leave Request</p>
</div>
</div>
</div>
<div class="col-sm-4 col-lg-4 leaves_request_month" style="padding-right:0px !important" >
<div class="card text-color" style="height: 102px;">
<div class="card-body">
<h4 class="mb-0">
<p class="stat-count"><t t-esc="widget.login_employee.leaves_to_approve"/></p>
</h4>
<p class="stat-title">This Month</p>
</div>
</div>
</div>
<div class="col-sm-4 col-lg-4 hr_leave_request_approve" style="padding-right:0px !important">
<div class="card text-color" style="height: 102px;">
<div class="card-body">
<h4 class="mb-0">
<p class="stat-count"><t t-esc="widget.login_employee.leaves_to_approve"/></p>
</h4>
<p class="stat-title">To Approve</p>
</div>
</div>
</div>
</div>
<div class="col-sm-6 col-lg-6 hr_leave_allocations_approve">
<div class="card text-color">
<div class="card-body pb-0">
<h4 class="mb-0">
<p class="stat-count"><t t-esc="widget.login_employee.leaves_alloc_req"/></p>
</h4>
<p class="stat-title">Leave Allocations</p>
</div>
</div>
</div>
<div class="col-sm-6 col-lg-6 hr_job_application_approve">
<div class="card text-color">
<div class="card-body pb-0">
<h4 class="mb-0">
<p class="stat-count"><t t-esc="widget.login_employee.job_applications"/></p>
</h4>
<p class="stat-title">Job Applications</p>
</div>
</div>
</div>
</div>
</t>
<t t-name="BirthdayEventDashboard">
<t t-if="widget.employee_birthday">
<div class="col-xs-12">
<div class="hr_birthday">
Upcoming Birthdays
</div>
</div>
<div class="col-xs-12">
<t t-foreach="widget.employee_birthday" t-as="employee">
<div class="col-sm-6 col-lg-3 hr_leave_request_approve">
<div class="card text-color">
<div class="">
<div class="media">
<a href="#" style="float: left;padding-right: 6%;">
<img class="align-self-center rounded-circle mr-3" style="width:85px; height:85px;" alt=""
t-att-src="'data:image/png;base64,'+employee['image']"/>
</a>
<div class="media-body">
<h2 class="text-color display-6" style="font-size: 15px;"><t t-esc="employee['name']"/> </h2>
<p class="text-light"><t t-esc="employee['birthday']"/></p>
</div></div></div></div>
</div>
</t>
</div>
</t>
</t>
<t t-name="LoginEmployeeDetails">
<div class="col-xs-12 o_box" style="padding-top: 25px;">
<div class="col-md-6 col-sm-6">
<div class="card">
<div>
<div class="media">
<a href="#" style="float: left;padding-right: 7%;">
<img class="align-self-center rounded-circle mr-3" style="width:85px; height:85px;" alt=""
t-att-src="'data:image/png;base64,'+widget.login_employee['image']"/>
</a>
<div class="media-body">
<h2 class="text-color display-6"><t t-esc="widget.login_employee['name']"/> </h2>
<p class="text-light"><t t-esc="widget.login_employee['job_id'][1]"/></p>
</div></div></div></div>
</div>
<div class="col-md-2 col-sm-6 hr_payslip">
<div class="card">
<div class="card-body">
<div class="stat-widget-one">
<div class="stat-icon dib"><i class="fa fa-money"/></div>
<div class="stat-content dib">
<div class="stat-text">Payslips</div>
<div class="stat-digit"><t t-esc="widget.login_employee['payslip_count']"/></div>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-2 col-sm-6">
<div class="card">
<div class="card-body">
<div class="stat-widget-one">
<div class="stat-icon dib"><i class="fa fa-clock-o"/></div>
<div class="stat-content dib">
<div class="stat-text">Timesheets</div>
<div class="stat-digit"><t t-esc="widget.login_employee['timesheet_count']"/></div>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-2 col-sm-6 hr_contract">
<div class="card">
<div class="card-body">
<div class="stat-widget-one">
<div class="stat-icon dib"><i class="fa fa-fw fa-book"/></div>
<div class="stat-content dib">
<div class="stat-text">Contracts</div>
<div class="stat-digit"><t t-esc="widget.login_employee['contracts_count']"/></div>
</div>
</div>
</div>
</div>
</div>
</div>
</t>
</templates>

24
hrms_dashboard/views/dashboard_views.xml

@ -0,0 +1,24 @@
<odoo>
<data>
<record id="hr_action_dashboard" model="ir.actions.client">
<field name="name">Dashboard</field>
<field name="tag">hr_dashboard</field>
<!--<field name="target">main</field>-->
</record>
<menuitem id="menu_hrms_dashboard"
name="Dashboard"
action="hr_action_dashboard"
parent="hr.menu_hr_root"
sequence="-1"/>
</data>
<template id="assets_backend" name="Hr Dashboard assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/hrms_dashboard/static/src/js/hrms_dashboard.js"/>
<script type="text/javascript" src="/hrms_dashboard/static/lib/chart/Chart.min.js"/>
<script type="text/javascript" src="/hrms_dashboard/static/lib/chart/Chart.bundle.min.js"/>
<link rel="stylesheet" href="/hrms_dashboard/static/src/css/hrms_dashboard.css"/>
</xpath>
</template>
</odoo>
Loading…
Cancel
Save