Browse Source

[ADD] Initial Commit

pull/72/head
Sreejith P 7 years ago
parent
commit
5478e7f7e0
  1. 39
      hr_reminder/README.rst
  2. 25
      hr_reminder/__init__.py
  3. 45
      hr_reminder/__manifest__.py
  4. 24
      hr_reminder/controllers/__init__.py
  5. BIN
      hr_reminder/controllers/__init__.pyc
  6. 51
      hr_reminder/controllers/main.py
  7. BIN
      hr_reminder/controllers/main.pyc
  8. 69
      hr_reminder/controllers/time_reminder.py
  9. 6
      hr_reminder/docs/RELEASE_NOTES.md
  10. 24
      hr_reminder/models/__init__.py
  11. BIN
      hr_reminder/models/__init__.pyc
  12. 77
      hr_reminder/models/hr_reminder.py
  13. BIN
      hr_reminder/models/hr_reminder.pyc
  14. 10
      hr_reminder/security/hr_reminder_security.xml
  15. 5
      hr_reminder/security/ir.model.access.csv
  16. BIN
      hr_reminder/static/description/HRMS-BUTTON.png
  17. BIN
      hr_reminder/static/description/banner.jpg
  18. BIN
      hr_reminder/static/description/cybro-service.png
  19. BIN
      hr_reminder/static/description/cybro_logo.png
  20. BIN
      hr_reminder/static/description/icon.png
  21. 146
      hr_reminder/static/description/index.html
  22. BIN
      hr_reminder/static/description/popup.png
  23. BIN
      hr_reminder/static/description/reminder.png
  24. BIN
      hr_reminder/static/description/result.png
  25. BIN
      hr_reminder/static/description/set_date.png
  26. BIN
      hr_reminder/static/description/set_period.png
  27. 32
      hr_reminder/static/src/css/notification.css
  28. 84
      hr_reminder/static/src/js/reminder_topbar.js
  29. 28
      hr_reminder/static/src/xml/reminder_topbar.xml
  30. 79
      hr_reminder/views/hr_reminder_view.xml
  31. 11
      hr_reminder/views/reminder_template.xml

39
hr_reminder/README.rst

@ -0,0 +1,39 @@
Open HRMS Reminders Todo V11
============================
HR Reminder For OHRMS
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.

25
hr_reminder/__init__.py

@ -0,0 +1,25 @@
# -*- 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
from . import controllers

45
hr_reminder/__manifest__.py

@ -0,0 +1,45 @@
# -*- 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 Reminders Todo',
'version': '11.0.1.0.0',
'category': 'Extra Tools',
'summary': 'HR Reminder For OHRMS',
'author': 'Cybrosys Techno Solutions',
'company': 'Cybrosys Techno Solutions',
'website': "https://www.openhrms.com",
'depends': ['base', 'hr'],
'data': [
'security/ir.model.access.csv',
'security/hr_reminder_security.xml',
'views/hr_reminder_view.xml',
'views/reminder_template.xml',
],
'qweb': [
'static/src/xml/reminder_topbar.xml', ],
'images': ['static/description/banner.jpg'],
'license': 'AGPL-3',
'installable': True,
'auto_install': False,
'application': False,
}

24
hr_reminder/controllers/__init__.py

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

BIN
hr_reminder/controllers/__init__.pyc

Binary file not shown.

51
hr_reminder/controllers/main.py

@ -0,0 +1,51 @@
# -*- 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 http
from odoo.http import request
class Reminders(http.Controller):
@http.route('/hr_reminder/all_reminder', type='json', auth="public")
def all_reminder(self):
reminder = []
for i in request.env['hr.reminder'].search([]):
if i.reminder_active:
reminder.append(i.name)
return reminder
@http.route('/hr_reminder/reminder_active', type='json', auth="public")
def reminder_active(self, **kwargs):
reminder_value = kwargs.get('reminder_name')
value = []
for i in request.env['hr.reminder'].search([('name', '=', reminder_value)]):
value.append(i.model_name.model)
value.append(i.model_field.name)
value.append(i.search_by)
value.append(i.date_set)
value.append(i.date_from)
value.append(i.date_to)
# value.append(i.exclude_year)
return value

BIN
hr_reminder/controllers/main.pyc

Binary file not shown.

69
hr_reminder/controllers/time_reminder.py

@ -0,0 +1,69 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import werkzeug
from odoo.api import Environment
import odoo.http as http
from odoo.http import request
from odoo import SUPERUSER_ID
from odoo import registry as registry_get
class CalendarController(http.Controller):
@http.route('/calendar/meeting/accept', type='http', auth="calendar")
def accept(self, db, token, action, id, **kwargs):
registry = registry_get(db)
with registry.cursor() as cr:
env = Environment(cr, SUPERUSER_ID, {})
attendee = env['calendar.attendee'].search([('access_token', '=', token), ('state', '!=', 'accepted')])
if attendee:
attendee.do_accept()
return self.view(db, token, action, id, view='form')
@http.route('/calendar/meeting/decline', type='http', auth="calendar")
def declined(self, db, token, action, id):
registry = registry_get(db)
with registry.cursor() as cr:
env = Environment(cr, SUPERUSER_ID, {})
attendee = env['calendar.attendee'].search([('access_token', '=', token), ('state', '!=', 'declined')])
if attendee:
attendee.do_decline()
return self.view(db, token, action, id, view='form')
@http.route('/calendar/meeting/view', type='http', auth="calendar")
def view(self, db, token, action, id, view='calendar'):
registry = registry_get(db)
with registry.cursor() as cr:
# Since we are in auth=none, create an env with SUPERUSER_ID
env = Environment(cr, SUPERUSER_ID, {})
attendee = env['calendar.attendee'].search([('access_token', '=', token)])
timezone = attendee.partner_id.tz
lang = attendee.partner_id.lang or 'en_US'
event = env['calendar.event'].with_context(tz=timezone, lang=lang).browse(int(id))
# If user is logged, redirect to form view of event
# otherwise, display the simplifyed web page with event informations
if request.session.uid:
return werkzeug.utils.redirect('/web?db=%s#id=%s&view_type=form&model=calendar.event' % (db, id))
# NOTE : we don't use request.render() since:
# - we need a template rendering which is not lazy, to render before cursor closing
# - we need to display the template in the language of the user (not possible with
# request.render())
return env['ir.ui.view'].with_context(lang=lang).render_template(
'calendar.invitation_page_anonymous', {
'event': event,
'attendee': attendee,
})
# Function used, in RPC to check every 5 minutes, if notification to do for an event or not
@http.route('/calendar/notify', type='json', auth="user")
def notify(self):
return request.env['calendar.alarm_manager'].get_next_notif()
@http.route('/calendar/notify_ack', type='json', auth="user")
def notify_ack(self, type=''):
return request.env['res.partner']._set_calendar_last_notif_ack()

6
hr_reminder/docs/RELEASE_NOTES.md

@ -0,0 +1,6 @@
## Module hr_reminder
#### 21.04.2018
#### Version 11.0.1.0.0
##### ADD
- Initial commit for OpenHrms Project

24
hr_reminder/models/__init__.py

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

BIN
hr_reminder/models/__init__.pyc

Binary file not shown.

77
hr_reminder/models/hr_reminder.py

@ -0,0 +1,77 @@
# -*- 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 datetime import datetime
from odoo import models, fields
class HrPopupReminder(models.Model):
_name = 'hr.reminder'
name = fields.Char(string='Title', required=True)
model_name = fields.Many2one('ir.model', string="Model", required=True, domain="[('model', 'like','hr')]")
model_field = fields.Many2one('ir.model.fields', string='Field',
domain="[('model_id', '=',model_name),('ttype', 'in', ['datetime','date'])]",
required=True)
search_by = fields.Selection([('today', 'Today'),
('set_period', 'Set Period'),
('set_date', 'Set Date'), ],
required=True, string="Search By")
days_before = fields.Integer(string='Reminder before')
active = fields.Boolean(string="Active",default=True)
# exclude_year = fields.Boolean(string="Consider day alone")
reminder_active = fields.Boolean(string="Reminder Active")
date_set = fields.Date(string='Select Date')
date_from = fields.Date(string="Start Date")
date_to = fields.Date(string="End Date")
expiry_date = fields.Date(string="Reminder Expiry Date")
company_id = fields.Many2one('res.company', string='Company', required=True,
default=lambda self: self.env.user.company_id)
def reminder_scheduler(self):
now = fields.Datetime.from_string(fields.Datetime.now())
today = fields.Date.today()
obj = self.env['hr.reminder'].search([])
for i in obj:
if i.search_by != "today":
if i.expiry_date and datetime.strptime(today, "%Y-%m-%d") == datetime.strptime(i.expiry_date, "%Y-%m-%d"):
i.active = False
else:
if i.search_by == "set_date":
d1 = datetime.strptime(i.date_set, "%Y-%m-%d")
d2 = datetime.strptime(today, "%Y-%m-%d")
daydiff = abs((d2 - d1).days)
if daydiff <= i.days_before:
i.reminder_active = True
else:
i.reminder_active = False
elif i.search_by == "set_period":
d1 = datetime.strptime(i.date_from, "%Y-%m-%d")
d2 = datetime.strptime(today, "%Y-%m-%d")
daydiff = abs((d2 - d1).days)
if daydiff <= i.days_before:
i.reminder_active = True
else:
i.reminder_active = False
else:
i.reminder_active = True

BIN
hr_reminder/models/hr_reminder.pyc

Binary file not shown.

10
hr_reminder/security/hr_reminder_security.xml

@ -0,0 +1,10 @@
<?xml version="1.0" ?>
<odoo>
<record id="property_rule_hr_shift" model="ir.rule">
<field name="name">Hr Reminder Company</field>
<field name="model_id" ref="model_hr_reminder"/>
<field eval="True" name="global"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>
</odoo>

5
hr_reminder/security/ir.model.access.csv

@ -0,0 +1,5 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_hr_reminder_officer,hr.reminder.officer,hr_reminder.model_hr_reminder,hr.group_hr_user,1,1,1,1
access_hr_reminder_employee,hr.reminder.employee,hr_reminder.model_hr_reminder,hr.group_hr_manager,1,1,1,1
access_hr_reminder_manager,hr.reminder.manager,hr_reminder.model_hr_reminder,base.group_user,0,0,0,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_hr_reminder_officer hr.reminder.officer hr_reminder.model_hr_reminder hr.group_hr_user 1 1 1 1
3 access_hr_reminder_employee hr.reminder.employee hr_reminder.model_hr_reminder hr.group_hr_manager 1 1 1 1
4 access_hr_reminder_manager hr.reminder.manager hr_reminder.model_hr_reminder base.group_user 0 0 0 0

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
hr_reminder/static/description/banner.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 KiB

BIN
hr_reminder/static/description/cybro_logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
hr_reminder/static/description/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

146
hr_reminder/static/description/index.html

@ -0,0 +1,146 @@
<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">
<h2 class="oe_slogan">Reminders</h2>
<h4 class="oe_slogan">Cybrosys Technologies , www.cybrosys.com</h4>
<p class='oe_mt32'>
Reminders is an effective module,helps to memorise all your important dates. We
can set reminders to any model (eg: Sales,HR,Project etc..) and also their corresponding
date fields to compare.This eases the company work load to memorize the special
dates (eg: Expiration date,Deadline date,Assigned Date etc...).
</p>
</div>
</section>
<section class="oe_container ">
<div class="oe_row oe_padded">
<h2 class="oe_slogan">Set Your Reminders</h2>
<div class="oe_span12">
<p>
<h4>Settings>Pop-up Reminder>Reminder</h4>
<p>
<p> Set your reminders for any model and the corresponding date field.
Also this module allows different methods to search.</p>
</p>
</div>
<div class="oe_span13">
<div class="oe_demo oe_screenshot">
<img src="reminder.png">
</div>
</div></div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_padded">
<h2 class="oe_slogan">Search By</h2>
<div class="oe_span12">
<p> We can use 3 methods to search:</p>
<ul>
<li style="list-style:none !important;"><span style="color:green;"> &#8594;</span>&nbsp;&nbsp; Today: Compares to the current date.</li>
<li style="list-style:none !important;"><span style="color:green;"> &#8594;</span>&nbsp;&nbsp; Set Date: Compares with the given date.</li>
<li style="list-style:none !important;"><span style="color:green;"> &#8594;</span>&nbsp;&nbsp; Set Period: Reminder is set between a time range(Start date - End date).</li>
</ul>
<br>
</div>
<div class="oe_span6">
<h3>Set Date</h3>
<img class="oe_picture oe_screenshot" src="set_date.png">
</div>
<div class="oe_span6 ">
<h3>Set Period</h3>
<img class="oe_picture oe_screenshot" src="set_period.png">
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_padded">
<div class="oe_span12">
<h2 class="oe_slogan">Reminder Button</h2>
<h3 class="oe_slogan">Select the Reminder from the list of Reminders</h3>
</div>
<div class="oe_span13">
<div class="oe_demo oe_screenshot">
<img src="popup.png">
</div>
</div></div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_padded">
<div class="oe_span12">
<h2 class="oe_slogan">Related Result</h2>
</div>
<div class="oe_span13">
<div class="oe_demo oe_screenshot">
<img src="result.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/contact/" target="_blank"><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.odoo.com/apps/modules/browse?search=open+hrms" target="_blank"><i
class="fa fa-suitcase"></i> Other Open HRMS Addons </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/" target="_blank"><i
class="fa fa-wrench"></i> Request Customization </a>
</div>
<br>
<a href="https://www.cybrosys.com/" target="_blank">
<img src="cybro_logo.png" style="width: 190px; margin-bottom: 20px;" class="center-block">
</a>
</div>
</section>

BIN
hr_reminder/static/description/popup.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

BIN
hr_reminder/static/description/reminder.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

BIN
hr_reminder/static/description/result.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

BIN
hr_reminder/static/description/set_date.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

BIN
hr_reminder/static/description/set_period.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

32
hr_reminder/static/src/css/notification.css

@ -0,0 +1,32 @@
.oe_webclient_notification_action t {
color: white;
}
.oe_webclient_notification_action p {
color: white;
margin-top: 1em;
}
.label {
display: inline-block;
color: white;
max-width: 100%;
margin-bottom: 4px;
font-weight: bold;
font-size: larger;
}
.reminder-dropdown {
.o-flex(0, 1, auto);
background: #FFFFFF;
max-height: 400px;
min-height: 50px;
overflow-y: auto;
@media (max-width: @screen-xs-max) {
max-height: none;
}
.detail-client-address-country {
color: black;
}

84
hr_reminder/static/src/js/reminder_topbar.js

@ -0,0 +1,84 @@
odoo.define('hr_reminder.reminder_topbar', function (require) {
"use strict";
var core = require('web.core');
var SystrayMenu = require('web.SystrayMenu');
var Widget = require('web.Widget');
var QWeb = core.qweb;
var ajax = require('web.ajax');
var reminder_menu = Widget.extend({
template:'reminder_menu',
events: {
"click .dropdown-toggle": "on_click_reminder",
"click .detail-client-address-country": "reminder_active",
},
on_click_reminder: function (event) {
var self = this
ajax.jsonRpc("/hr_reminder/all_reminder", 'call',{}
).then(function(all_reminder){
self.all_reminder = all_reminder
self.$('.o_mail_navbar_dropdown_top').html(QWeb.render('reminder_menu',{
values: self.all_reminder
}));
})
},
reminder_active: function(){
var self = this;
var value =$("#reminder_select").val();
ajax.jsonRpc("/hr_reminder/reminder_active", 'call',{'reminder_name':value}
).then(function(reminder){
self.reminder = reminder
for (var i=0;i<1;i++){
var model = self.reminder[i]
var date = self.reminder[i+1]
console.log("DDDDDDDDDDDDDDDDDDDDDDDDDDDDDd",date,new Date())
if (self.reminder[i+2] == 'today'){
return self.do_action({
type: 'ir.actions.act_window',
res_model: model,
view_mode: 'list',
view_type: 'list',
domain: [[date, '=', new Date()]],
views: [[false, 'list']],
target: 'new',})
}
else if (self.reminder[i+2] == 'set_date'){
return self.do_action({
type: 'ir.actions.act_window',
res_model: model,
view_mode: 'list',
view_type: 'list',
domain: [[date, '=', self.reminder[i+3]]],
views: [[false, 'list']],
target: 'new',
})
}
else if (self.reminder[i+2] == 'set_period'){
return self.do_action({
type: 'ir.actions.act_window',
res_model: model,
view_mode: 'list',
view_type: 'list',
domain: [[date, '<', self.reminder[i+5]],[date, '>', self.reminder[i+4]]],
views: [[false, 'list']],
target: 'new',
})
}
}
});
},
});
SystrayMenu.Items.push(reminder_menu);
});

28
hr_reminder/static/src/xml/reminder_topbar.xml

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates>
<t t-name="reminder_menu">
<li class="o_mail_navbar_item">
<a class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false" href="#" title="Reminders">
<i class="fa fa-bell"/> <span class="o_notification_counter"/></a>
<ul class="o_mail_navbar_dropdown dropdown-menu" role="menu">
<li class="o_mail_navbar_dropdown_top">
<t t-if="values">
<div>
<span class='label'>Reminders</span>
<select id="reminder_select" name="Reminder" class='detail-client-address-country'>
<t t-if="values">
<t t-foreach='values' t-as='val'>
<option class="dropdown-options" t-att-value='val' >
<t t-esc='val'/>
</option>
</t></t>
</select></div></t>
</li>
</ul>
</li>
</t>
</templates>

79
hr_reminder/views/hr_reminder_view.xml

@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<record id="ir_cron_scheduler_reminder_action" model="ir.cron">
<field name="name">Reminder scheduler</field>
<field name="model_id" ref="model_hr_reminder"/>
<field name="state">code</field>
<field name="code">model.reminder_scheduler()</field>
<field name="user_id" ref="base.user_root"/>
<field name="interval_number">1</field>
<field name="interval_type">minutes</field>
<field name="numbercall">-1</field>
<field eval="False" name="doall"/>
<!--<field eval="'hr.reminder'" name="model"/>-->
<!--<field eval="'reminder_scheduler'" name="function"/>-->
</record>
<record model="ir.ui.view" id="hr_reminder_form_view">
<field name="name">hr.reminder.form.view</field>
<field name="model">hr.reminder</field>
<field name="arch" type="xml">
<form string="HR Reminder">
<sheet>
<div class="oe_title">
<h1 class="o_row">
<field name="name" placeholder="Reminder Title..." />
</h1>
</div>
<group>
<group>
<field name="model_name" />
<field name="search_by"/>
<field name="date_from" attrs="{'invisible': [('search_by','not in','set_period')], 'required': [('search_by', '=', 'set_period')]}"/>
<field name="date_set" attrs="{'invisible': [('search_by','not in','set_date')], 'required': [('search_by', '=', 'set_date')]}"/>
<field name="date_to" attrs="{'invisible': [('search_by','not in','set_period')], 'required': [('search_by', '=', 'set_period')]}"/>
<!--<field name="exclude_year" attrs="{'invisible': [('search_by','in','set_period')]}"/>-->
<field name="company_id"/>
</group>
<group>
<field name="model_field"/>
<field name="days_before" attrs="{'invisible': [('search_by','=','today')]}"/>
<field name="expiry_date" attrs="{'invisible': [('search_by','=','today')]}"/>
<field name="active"/>
</group>
</group>
</sheet>
</form>
</field>
</record>
<record model="ir.ui.view" id="hr_reminder_tree_view">
<field name="name">hr.reminder.tree.view</field>
<field name="model">hr.reminder</field>
<field name="arch" type="xml">
<tree string="Pop-Up Reminder">
<field name="name"/>
<field name="model_name" />
<field name="model_field"/>
<field name="company_id"/>
</tree>
</field>
</record>
<record model="ir.actions.act_window" id="action_hr_reminder">
<field name="name">Reminders</field>
<field name="res_model">hr.reminder</field>
<field name="view_mode">tree,form</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click here to create new reminder.
</p>
</field>
</record>
<menuitem name ="Hr Reminder" id="hr_reminder_menu" parent="hr.menu_hr_root" sequence="8"/>
<menuitem name ="Reminder" id="reminder_menu" parent="hr_reminder_menu" action="action_hr_reminder"/>
</data>
</openerp>

11
hr_reminder/views/reminder_template.xml

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="assets_backend" name="mail assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<link rel="stylesheet" href="/hr_reminder/static/src/css/notification.css"/>
<script type="text/javascript" src="/hr_reminder/static/src/js/reminder_topbar.js"></script>
</xpath>
</template>
</data>
</openerp>
Loading…
Cancel
Save