diff --git a/birth_day_notification/README.rst b/birth_day_notification/README.rst new file mode 100644 index 000000000..1248eba5b --- /dev/null +++ b/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 \ No newline at end of file diff --git a/birth_day_notification/__init__.py b/birth_day_notification/__init__.py new file mode 100644 index 000000000..4e35b815b --- /dev/null +++ b/birth_day_notification/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Sreejith P() +# 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 . +# +############################################################################## +import models diff --git a/birth_day_notification/__manifest__.py b/birth_day_notification/__manifest__.py new file mode 100644 index 000000000..db25c033e --- /dev/null +++ b/birth_day_notification/__manifest__.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Sreejith P() +# 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 . +# +############################################################################## + +{ + '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, +} + diff --git a/birth_day_notification/data/email.xml b/birth_day_notification/data/email.xml new file mode 100644 index 000000000..3fec8a2b7 --- /dev/null +++ b/birth_day_notification/data/email.xml @@ -0,0 +1,37 @@ + + + + + Employee Birthday Notification + 1 + days + -1 + + + + + + + + Birthday Notification For Employees + + Birthday Notification + +
+

Dear ${object.name},

+

Birthday Wishes

+

Hope you have a great Year Ahead. Stay Healthy, Stay Happy.Cheers.

+
+
+

+

+ Your Family at + ${user.company_id.name} +

+
]]> +
+ +
+
+
diff --git a/birth_day_notification/models/__init__.py b/birth_day_notification/models/__init__.py new file mode 100644 index 000000000..87706d155 --- /dev/null +++ b/birth_day_notification/models/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Sreejith P() +# 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 . +# +############################################################################## +import email diff --git a/birth_day_notification/models/email.py b/birth_day_notification/models/email.py new file mode 100644 index 000000000..2b8f497b2 --- /dev/null +++ b/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 diff --git a/birth_day_notification/static/description/banner.jpg b/birth_day_notification/static/description/banner.jpg new file mode 100644 index 000000000..1d3fab81f Binary files /dev/null and b/birth_day_notification/static/description/banner.jpg differ diff --git a/birth_day_notification/static/description/birthday_1.png b/birth_day_notification/static/description/birthday_1.png new file mode 100644 index 000000000..213374933 Binary files /dev/null and b/birth_day_notification/static/description/birthday_1.png differ diff --git a/birth_day_notification/static/description/cybro_logo.png b/birth_day_notification/static/description/cybro_logo.png new file mode 100644 index 000000000..bb309114c Binary files /dev/null and b/birth_day_notification/static/description/cybro_logo.png differ diff --git a/birth_day_notification/static/description/icon.png b/birth_day_notification/static/description/icon.png new file mode 100644 index 000000000..69f73d322 Binary files /dev/null and b/birth_day_notification/static/description/icon.png differ diff --git a/birth_day_notification/static/description/index.html b/birth_day_notification/static/description/index.html new file mode 100644 index 000000000..38f22ff77 --- /dev/null +++ b/birth_day_notification/static/description/index.html @@ -0,0 +1,82 @@ +
+
+

Birthday Notification By E-mail

+

This module will wish the employees on their birthday

+ +

Author : Cybrosys Techno Solutions , www.cybrosys.com

+
+

Features:

+
    +
  •    Adds a cron job to invoke email
  • +
  •    Adds an email template
  • +
+
+
+
+ +
+
+
+

Overview

+

+ 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. +

+
+
+
+ +
+
+

Employee Form

+
+

+ ☛ Give Date of Birth for employee.
+ ☛ Give work email.
+

+
+ +
+
+
+
+ +
+
+

Email Template

+
+

+ ☛ The cron job will invoke the email
+ ☛ Email template is very simple
+

+
+ +
+
+
+
+ +
+

Need Any Help?

+ +
diff --git a/birth_day_notification/static/description/temp.png b/birth_day_notification/static/description/temp.png new file mode 100644 index 000000000..513206a88 Binary files /dev/null and b/birth_day_notification/static/description/temp.png differ