Browse Source

[ADD] Initial Commit

pull/29/head
SHEREEF PT 8 years ago
parent
commit
679af2f6a1
  1. 20
      birth_day_notification/README.rst
  2. 23
      birth_day_notification/__init__.py
  3. 41
      birth_day_notification/__manifest__.py
  4. 37
      birth_day_notification/data/email.xml
  5. 23
      birth_day_notification/models/__init__.py
  6. 39
      birth_day_notification/models/email.py
  7. BIN
      birth_day_notification/static/description/banner.jpg
  8. BIN
      birth_day_notification/static/description/birthday_1.png
  9. BIN
      birth_day_notification/static/description/cybro_logo.png
  10. BIN
      birth_day_notification/static/description/icon.png
  11. 82
      birth_day_notification/static/description/index.html
  12. BIN
      birth_day_notification/static/description/temp.png

20
birth_day_notification/README.rst

@ -0,0 +1,20 @@
Birthday Notification v10
=========================
This module will wish the employees on their birthday.
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>

23
birth_day_notification/__init__.py

@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-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

41
birth_day_notification/__manifest__.py

@ -0,0 +1,41 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-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': 'Birthday Notification By E-mail',
'version': '10.0.1.0.0',
'summary': 'This module will wish the employees on their birthday.',
'category': 'Human Resource',
'sequence': 55,
'author': "Cybrosys Techno Solutions",
'company': 'Cybrosys Techno Solutions',
'website': 'https://www.cybrosys.com',
'depends': ['hr'],
'data': ['data/email.xml'],
'test': [],
'license': 'AGPL-3',
'images': ['static/description/banner.jpg'],
'installable': True,
'auto_install': False,
}

37
birth_day_notification/data/email.xml

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<record model="ir.cron" id="employee_birthday_reminder">
<field name="name">Employee Birthday Notification</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field name="nextcall" eval="(DateTime.now() + relativedelta(days=1)).strftime('%Y-%m-%d 00:00:00')" />
<field name="doall" eval="False"/>
<field name="model" eval="'hr.employee'"/>
<field name="function" eval="'mail_reminder'"/>
<field name="args" eval="'()'" />
</record>
<record id="birthday_notification" model="mail.template">
<field name="name">Birthday Notification For Employees</field>
<field name="model_id" ref="birth_day_notification.model_hr_employee"/>
<field name="subject">Birthday Notification</field>
<field name="body_html"><![CDATA[
<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; ">
<div style="padding:0px;width:600px;margin:auto;background: #FFFFFF repeat top /100%;color:#777777">
<p>Dear ${object.name},</p>
<p>Birthday Wishes</p>
<p>Hope you have a great Year Ahead. Stay Healthy, Stay Happy.Cheers.</p>
</div>
<div style="padding:0px;width:600px;margin:auto; margin-top: 10px; background: #fff repeat top /100%;color:#777777">
<p style="font-size: 11px; margin-top: 10px;">
<br></br>
Your Family at
<strong>${user.company_id.name}</strong>
</p>
</div>]]>
</field>
<field name="user_signature" eval="False"/>
</record>
</data>
</openerp>

23
birth_day_notification/models/__init__.py

@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-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

39
birth_day_notification/models/email.py

@ -0,0 +1,39 @@
# -*- coding: utf-8 -*-
from datetime import datetime
from odoo import models, api
from odoo import SUPERUSER_ID
class ReminderVisa(models.Model):
_inherit = 'hr.employee'
@api.model
def mail_reminder(self):
today = datetime.now()
employees = self.env['hr.employee'].search([])
for i in employees:
if i.birthday:
daymonth = datetime.strptime(i.birthday, "%Y-%m-%d")
if today.day == daymonth.day and today.month == daymonth.month:
self.send_birthday_wish(i.id)
return
@api.model
def send_birthday_wish(self, emp_id):
su_id = self.env['res.partner'].browse(SUPERUSER_ID)
template_id = self.env['ir.model.data'].get_object_reference('birth_day_notification',
'birthday_notification')[1]
template_browse = self.env['mail.template'].browse(template_id)
email_to = self.env['hr.employee'].browse(emp_id).work_email
if template_browse:
values = template_browse.generate_email(emp_id, fields=None)
values['email_to'] = email_to
values['email_from'] = su_id.email
values['res_id'] = False
if not values['email_to'] and not values['email_from']:
pass
mail_mail_obj = self.env['mail.mail']
msg_id = mail_mail_obj.create(values)
if msg_id:
mail_mail_obj.send(msg_id)
return True

BIN
birth_day_notification/static/description/banner.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

BIN
birth_day_notification/static/description/birthday_1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

BIN
birth_day_notification/static/description/cybro_logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
birth_day_notification/static/description/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

82
birth_day_notification/static/description/index.html

@ -0,0 +1,82 @@
<section class="oe_container">
<div class="oe_spaced">
<h2 class="oe_slogan">Birthday Notification By E-mail</h2>
<h3 class="oe_slogan">This module will wish the employees on their birthday</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;"> &#8594;</span>&nbsp;&nbsp; Adds a cron job to invoke email</li>
<li style="list-style:none !important;"><span style="color:green;"> &#8594;</span>&nbsp;&nbsp; Adds an email template</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">
HR departments need not worry to wish their employees for their Birthday. In this module we have included the feature to send an email Birthday notification to the employee.
</p>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_spaced">
<h4 class="oe_slogan">Employee Form</h4>
<div class="oe_span12">
<p class='oe_mt32'>
&#x261B; Give Date of Birth for employee.<br>
&#x261B; Give work email.<br>
</p>
<div class="oe_demo oe_picture oe_screenshot" style="max-height: 100%;">
<img src="birthday_1.png">
</div>
</div>
</div>
</section>
<section>
<div class="oe_row oe_spaced oe_dark">
<h4 class="oe_slogan">Email Template</h4>
<div class="oe_span12">
<p class='oe_mt32'>
&#x261B; The cron job will invoke the email<br>
&#x261B; Email template is very simple<br>
</p>
<div class="oe_row_img oe_centered">
<img class="oe_picture oe_screenshot" src="temp.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>

BIN
birth_day_notification/static/description/temp.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Loading…
Cancel
Save