15 changed files with 317 additions and 0 deletions
@ -0,0 +1,20 @@ |
|||||
|
Visa Expiration Notification By E-mail v8 |
||||
|
========================================= |
||||
|
|
||||
|
This module will alert the employees on visa expiry. |
||||
|
|
||||
|
cron job |
||||
|
======== |
||||
|
This module add a cron job to invoke the email service. |
||||
|
|
||||
|
Configuration |
||||
|
============= |
||||
|
You should configure the outgoing mail server and provide valid email id for users. |
||||
|
|
||||
|
Credits |
||||
|
======= |
||||
|
Cybrosys Techno Solutions |
||||
|
|
||||
|
Author |
||||
|
====== |
||||
|
* Cybrosys Techno Solutions <http://www.cybrosys.com> |
@ -0,0 +1,24 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################## |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# Copyright (C) 2015-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). |
||||
|
# Author: Sreejith P(<http://www.cybrosys.com>) |
||||
|
# you can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# It is forbidden to publish, distribute, sublicense, or sell copies |
||||
|
# of the Software or modified copies of the Software. |
||||
|
# |
||||
|
# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################## |
||||
|
|
||||
|
import models |
@ -0,0 +1,43 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################## |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# Copyright (C) 2015-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). |
||||
|
# Author: Sreejith P(<http://www.cybrosys.com>) |
||||
|
# you can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# It is forbidden to publish, distribute, sublicense, or sell copies |
||||
|
# of the Software or modified copies of the Software. |
||||
|
# |
||||
|
# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################## |
||||
|
|
||||
|
{ |
||||
|
'name': 'Visa Expiration Notification By E-mail', |
||||
|
'version': '8.0.1.0.0', |
||||
|
'category': 'Human Resource', |
||||
|
'summary': 'Alert on Visa expiry date based on settings in employee contract form.', |
||||
|
'sequence': 55, |
||||
|
'author': 'Cybrosys techno solutions', |
||||
|
'company': 'Cybrosys Techno Solutions', |
||||
|
'website': 'https://www.cybrosys.com', |
||||
|
'depends': ['hr_contract'], |
||||
|
'data': [ |
||||
|
'views/email.xml', |
||||
|
'views/settings_hr.xml' |
||||
|
], |
||||
|
'test': [], |
||||
|
'license': 'AGPL-3', |
||||
|
'images': ['static/description/banner.jpg'], |
||||
|
'installable': True, |
||||
|
'auto_install': False, |
||||
|
} |
@ -0,0 +1,25 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################## |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# Copyright (C) 2015-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). |
||||
|
# Author: Sreejith P(<http://www.cybrosys.com>) |
||||
|
# you can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# It is forbidden to publish, distribute, sublicense, or sell copies |
||||
|
# of the Software or modified copies of the Software. |
||||
|
# |
||||
|
# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################## |
||||
|
|
||||
|
import email |
||||
|
import settings_hr |
@ -0,0 +1,44 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
from openerp import models |
||||
|
from datetime import datetime, timedelta |
||||
|
|
||||
|
|
||||
|
class ReminderVisa(models.Model): |
||||
|
_inherit = 'hr.contract' |
||||
|
|
||||
|
def mail_reminder(self, cr, uid, context=None): |
||||
|
i = self.pool.get('hr.config.settings').search(cr, uid, [], limit=1, order='id desc') |
||||
|
x = self.pool.get('hr.config.settings').browse(cr, uid, i and i[0], context) |
||||
|
if x.visa_validity != False: |
||||
|
tommorrow = datetime.now()+timedelta(days=x.limit_amount) |
||||
|
date_tommorrow = tommorrow.date() |
||||
|
issue_obj = self.pool.get('hr.contract') |
||||
|
match = issue_obj.search(cr, uid, [('visa_expire', '<=', date_tommorrow)]) |
||||
|
for i in match: |
||||
|
browse_hr_contract = issue_obj.browse(cr, uid, i) |
||||
|
browse_id = browse_hr_contract.employee_id |
||||
|
self.send_email_employee(cr, uid, browse_id.id, browse_id.name, browse_hr_contract.visa_expire, |
||||
|
date_tommorrow, context) |
||||
|
else: |
||||
|
pass |
||||
|
|
||||
|
def send_email_employee(self, cr, uid, emp_id, emp_name, exp_date, no_days, context=None): |
||||
|
email_template_obj = self.pool.get('email.template') |
||||
|
template_ids = email_template_obj.search(cr, uid, [('name', '=', 'Visa Alert Email For Employees')], context=context) |
||||
|
template_brwse = email_template_obj.browse(cr, uid, template_ids) |
||||
|
email_to = self.pool.get('hr.employee').browse(cr, uid, emp_id, context).work_email |
||||
|
body_html = " Hello "+emp_name+",<br>Your visa is going to expire on "+str(exp_date) +\ |
||||
|
". Please renew it before expiry date" |
||||
|
if template_ids: |
||||
|
values = email_template_obj.generate_email(cr, uid, template_ids[0], emp_id, context=context) |
||||
|
values['subject'] = template_brwse.subject |
||||
|
values['email_to'] = email_to |
||||
|
values['body_html'] = body_html |
||||
|
values['body'] = body_html |
||||
|
values['email_from'] = template_brwse.email_from |
||||
|
values['res_id'] = False |
||||
|
mail_mail_obj = self.pool.get('mail.mail') |
||||
|
msg_id = mail_mail_obj.create(cr, uid, values, context=context) |
||||
|
if msg_id: |
||||
|
mail_mail_obj.send(cr, uid, [msg_id], context=context) |
||||
|
return True |
@ -0,0 +1,18 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
from openerp.osv import fields, osv |
||||
|
|
||||
|
|
||||
|
class SettingOption(osv.osv_memory): |
||||
|
_inherit = 'hr.config.settings' |
||||
|
_columns = { |
||||
|
'visa_validity': fields.boolean("Get email notification on employee VISA expiration", |
||||
|
help="""Allow to define from how many days before to start alert |
||||
|
Employee and other configured addresses will get the notification emails each day."""), |
||||
|
'limit_amount': fields.integer("from", size=10) |
||||
|
} |
||||
|
|
||||
|
def get_default_visa_details(self, cr, uid, fields, context=None): |
||||
|
ir_values = self.pool.get('ir.values') |
||||
|
visa_validity = ir_values.get_default(cr, uid, 'sale.config.settings', 'visa_validity') |
||||
|
limit_amount = ir_values.get_default(cr, uid, 'sale.config.settings', 'limit_amount') |
||||
|
return {'visa_validity': visa_validity, 'limit_amount': limit_amount} |
After Width: | Height: | Size: 74 KiB |
After Width: | Height: | Size: 74 KiB |
After Width: | Height: | Size: 50 KiB |
After Width: | Height: | Size: 87 KiB |
After Width: | Height: | Size: 84 KiB |
After Width: | Height: | Size: 17 KiB |
@ -0,0 +1,96 @@ |
|||||
|
<section class="oe_container"> |
||||
|
<div class="oe_spaced"> |
||||
|
<h2 class="oe_slogan">Visa Expiration Notification By E-mail</h2> |
||||
|
<h3 class="oe_slogan">This module will alert the employees on visa expiry.</h3> |
||||
|
|
||||
|
<h4 class="oe_slogan">Author : Cybrosys Techno Solutions , www.cybrosys.com</h4> |
||||
|
<div style="padding-left:66px;"> |
||||
|
<h4>Features:</h4> |
||||
|
<ul> |
||||
|
<li style="list-style:none !important;"><span style="color:green;"> →</span> Adds a cron job to invoke email</li> |
||||
|
<li style="list-style:none !important;"><span style="color:green;"> →</span> Adds an email template for employees</li> |
||||
|
</ul> |
||||
|
</div> |
||||
|
</div> |
||||
|
</section> |
||||
|
|
||||
|
<section class="oe_container oe_dark"> |
||||
|
<div class="oe_spaced"> |
||||
|
<div class="oe_picture"> |
||||
|
<h3 class="oe_slogan">Overview</h3> |
||||
|
<p class="oe_mt32"> |
||||
|
You will not miss out of the visa expiry date anymore. |
||||
|
This module provides you the option to set alert on Visa expiry date that will remind employee for renewal. |
||||
|
You will be notified of the expiry date of the Visa as per the prior number of days being set in the HR configuration.</p> |
||||
|
</div> |
||||
|
</div> |
||||
|
</section> |
||||
|
|
||||
|
<section class="oe_container"> |
||||
|
<div class="oe_row oe_spaced"> |
||||
|
<h4 class="oe_slogan">Employee Form</h4> |
||||
|
<div class="oe_span12"> |
||||
|
<p class='oe_mt32'> |
||||
|
☛ Give work email.<br> |
||||
|
</p> |
||||
|
<div class="oe_row_img oe_centered"> |
||||
|
<img class="oe_picture oe_screenshot" src="employee_form.png"> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</section> |
||||
|
|
||||
|
<section class="oe_container oe_dark"> |
||||
|
<div class="oe_row oe_spaced"> |
||||
|
<h4 class="oe_slogan">Contract Form</h4> |
||||
|
<div class="oe_span12"> |
||||
|
<p class='oe_mt32'> |
||||
|
☛ Give visa Expiry Date<br> |
||||
|
</p> |
||||
|
<div class="oe_row_img oe_centered"> |
||||
|
<img class="oe_picture oe_screenshot" src="contract_form.png"> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</section> |
||||
|
|
||||
|
<section class="oe_container"> |
||||
|
<div class="oe_row oe_spaced"> |
||||
|
<h4 class="oe_slogan">HR Configuration</h4> |
||||
|
<div class="oe_span12"> |
||||
|
<p class='oe_mt32'> |
||||
|
☛ Tick "Get email notification on employee VISA expiration"<br> |
||||
|
☛ Once you enable the option you get a field to configure the number of days before which you need the alert.<br> |
||||
|
</p> |
||||
|
<div class="oe_row_img oe_centered"> |
||||
|
<img class="oe_picture oe_screenshot" src="hr_config.png"> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</section> |
||||
|
|
||||
|
<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="http://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="http://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="http://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> |
||||
|
<a href="https://twitter.com/cybrosys" target="_blank"><i class="fa fa-2x fa-twitter" style="color:white;background: #00a0d1;width:35px;"></i></a></td> |
||||
|
<a href="https://www.linkedin.com/company/cybrosys-technologies-pvt-ltd" target="_blank"><i class="fa fa-2x fa-linkedin" style="color:white;background: #31a3d6;width:35px;padding-left: 3px;"></i></a></td> |
||||
|
<a href="https://www.facebook.com/cybrosystechnologies" target="_blank"><i class="fa fa-2x fa-facebook" style="color:white;background: #3b5998;width:35px;padding-left: 8px;"></i></a></td> |
||||
|
<a href="https://plus.google.com/106641282743045431892/about" target="_blank"><i class="fa fa-2x fa-google-plus" style="color:white;background: #c53c2c;width:35px;padding-left: 3px;"></i></a></td> |
||||
|
<a href="https://in.pinterest.com/cybrosys" target="_blank"><i class="fa fa-2x fa-pinterest" style="color:white;background: #ac0f18;width:35px;padding-left: 3px;"></i></a></td> |
||||
|
</div> |
||||
|
</div> |
||||
|
</section> |
@ -0,0 +1,21 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<openerp> |
||||
|
<data> |
||||
|
<record model="ir.cron" id="employee_visa_reminder"> |
||||
|
<field name="name">HR Employee Visa Expiration</field> |
||||
|
<field name="interval_number">1</field> |
||||
|
<field name="interval_type">days</field> |
||||
|
<field name="numbercall">-1</field> |
||||
|
<field name="doall" eval="False"/> |
||||
|
<field name="model" eval="'hr.contract'"/> |
||||
|
<field name="function" eval="'mail_reminder'"/> |
||||
|
<field name="args" eval="'()'" /> |
||||
|
</record> |
||||
|
<record model="email.template" id="email_template_for_alert_employees"> |
||||
|
<field name="name">Visa Alert Email For Employees</field> |
||||
|
<field name="model_id" ref="visa_expiration.model_hr_contract"/> |
||||
|
<field name="subject">Notification About Your Visa Expiry Date</field> |
||||
|
<field name="email_from">${object.employee_id.company_id.email or object.employee_id.user_id.user_email or 'noreply@localhost'}</field> |
||||
|
</record> |
||||
|
</data> |
||||
|
</openerp> |
@ -0,0 +1,26 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<openerp> |
||||
|
<data> |
||||
|
<record id="set_option" model="ir.ui.view"> |
||||
|
<field name="name">set.option.form</field> |
||||
|
<field name="model">hr.config.settings</field> |
||||
|
<field name="inherit_id" ref="hr.view_human_resources_configuration"/> |
||||
|
<field name="arch" type="xml"> |
||||
|
<xpath expr="//div[@name='hr_payroll']" position="before"> |
||||
|
<!--<group>--> |
||||
|
<!--<label for="id" string="Visa Expire Mail Alert"/>--> |
||||
|
<div> |
||||
|
<field name="visa_validity" class="oe_inline" /> |
||||
|
<label for="visa_validity"/> |
||||
|
<span class="oe_separate-from-text" attrs="{'invisible': [('visa_validity','=',False)]}"> |
||||
|
<label for="limit_amount"/> |
||||
|
<field name="limit_amount" |
||||
|
attrs="{'required': [('visa_validity','=',True)]}" class="oe_inline"/> days before |
||||
|
</span> |
||||
|
</div> |
||||
|
<!--</group>--> |
||||
|
</xpath> |
||||
|
</field> |
||||
|
</record> |
||||
|
</data> |
||||
|
</openerp> |
Loading…
Reference in new issue