19 changed files with 498 additions and 0 deletions
@ -0,0 +1,17 @@ |
|||
OHRMS Leave Request Aliasing |
|||
---------------------------- |
|||
Supporting Addon for Open HRMS, Allows You To Create Leave Request Automatically From Incoming Emails |
|||
|
|||
Connect with experts |
|||
-------------------- |
|||
|
|||
If you have any question/queries/additional works on OpenHRMS or this module, You can drop an email directly to Cybrosys. |
|||
|
|||
Contacts |
|||
-------- |
|||
info - info@cybrosys.com |
|||
Jesni Banu - jesni@cybrosys.in |
|||
|
|||
Website: |
|||
https://www.openhrms.com |
|||
https://www.cybrosys.com |
@ -0,0 +1,6 @@ |
|||
## Module <hr_leave_request_aliasing> |
|||
|
|||
#### 30.03.2018 |
|||
#### Version 10.0.1.0.0 |
|||
##### ADD |
|||
- Initial commit for OpenHrms Project |
@ -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: Jesni Banu (<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 |
|||
|
|||
|
@ -0,0 +1,45 @@ |
|||
# -*- 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: Jesni Banu (<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': 'OHRMS Leave Request Aliasing', |
|||
'version': '10.0.1.0.0', |
|||
'summary': """Allows You To Create Leave Request Automatically From Incoming Emails""", |
|||
'description': 'This module allows you to create leave request automatically from incoming mails.', |
|||
'category': 'Generic Modules/Human Resources', |
|||
'author': 'Cybrosys Techno Solutions', |
|||
'company': 'Cybrosys Techno Solutions', |
|||
'website': "https://www.openhrms.com", |
|||
'depends': ['base_setup', 'hr_holidays'], |
|||
'data': [ |
|||
'data/web_planner_data.xml', |
|||
'views/hr_leave_template.xml', |
|||
'views/leave_request_alias_view.xml', |
|||
'views/res_config_views.xml', |
|||
], |
|||
'demo': [], |
|||
'images': ['static/description/banner.jpg'], |
|||
'license': 'AGPL-3', |
|||
'installable': True, |
|||
'auto_install': False, |
|||
'application': False, |
|||
} |
@ -0,0 +1,81 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<template id="hr_leave_planner"> |
|||
<t t-call="web_planner.pages"> |
|||
<t t-call="web_planner.category"> |
|||
<t t-set="menu_categorytitle">Setup</t> |
|||
<t t-set="menu_categoryclasses" t-value="'fa-magic'"/> |
|||
<t t-call="web_planner.page"> |
|||
<t t-set="page_title">Get Mobile</t> |
|||
<t t-if="not (alias_name and alias_domain)"> |
|||
<div class="alert alert-warning" role="alert"> |
|||
<strong>Your email gateway is not configured.</strong> Please configure your email |
|||
gateway from the Settings app, menu <i>General Settings</i>. |
|||
</div> |
|||
<p> |
|||
Once your email gateway is configured, come back to this screen |
|||
to setup the next steps. |
|||
</p> |
|||
</t> |
|||
<t t-if="alias_name and alias_domain"> |
|||
<p> |
|||
To create leave request by email, send leave request by email with the following |
|||
information: |
|||
</p> |
|||
|
|||
<dl class="dl-horizontal"> |
|||
<dt>From: Your Email</dt> |
|||
<dd>Your Email Address</dd> |
|||
<dt>To:</dt> |
|||
<dd><t t-esc="alias_name"/>@<t t-esc="alias_domain"/></dd> |
|||
<dt>Subject: </dt> |
|||
<dd><strong class="text-info">LEAVE REQUEST</strong> Free Description with Date From: and Date To:<strong class="text-primary"></strong></dd> |
|||
</dl> |
|||
<hr class="mb32"/> |
|||
<p> |
|||
The <strong class="text-info">LEAVE REQUEST</strong> is mandatory and should be in the |
|||
subject of your email. This |
|||
will root the leave request automatically on your |
|||
Odoo. |
|||
</p><p> |
|||
Also you need to set <strong class="text-primary">Date From: and Date To:</strong> |
|||
at the end of the body of your email. |
|||
</p> |
|||
<div class="alert alert-info" role="alert"> |
|||
<b>Note:</b> Set the same email address on your employee form(working email) than |
|||
the one you use are your "From:". Otherwise, your |
|||
leave request will not be accepted by email. |
|||
</div> |
|||
</t> |
|||
</t> |
|||
</t> |
|||
|
|||
<t t-call="web_planner.page"> |
|||
<t t-set="page_title">End</t> |
|||
<t t-set="hide_title" t-value="True"/> |
|||
<t t-set="hide_from_menu" t-value="True"/> |
|||
<t t-set="hide_mark_as_done" t-value="True"/> |
|||
<h1 class="text-center o_planner_trophy" data-icon="" /> |
|||
<div class="text-center"> |
|||
<h1>Congratulations, you're done!</h1> |
|||
<h3>We hope this feature helped you manage your leave request efficiently.</h3> |
|||
<h4>Don't hesitate to <a href="mailto:info@cybrosys.com" target="_blank">send us an email</a> to describe<br/> your experience or to suggest improvements!</h4> |
|||
|
|||
<p>Have a wonderful day,<br/>- Cybrosys</p> |
|||
<img src="/hr_leave_request_aliasing/static/description/cybro_logo.png"/> |
|||
</div> |
|||
</t> |
|||
</t> |
|||
</template> |
|||
|
|||
<record id="planner_hr_leave" model="web.planner"> |
|||
<field name="name">Leave strategy planner</field> |
|||
<field name="view_id" ref="hr_leave_planner"/> |
|||
<field name="menu_id" ref="hr_holidays.menu_hr_holidays_root"/> |
|||
<field name="planner_application">planner_hr_leave</field> |
|||
<field name="tooltip_planner"><![CDATA[ |
|||
Send receipts by email to create leave request efficiently. |
|||
]]> |
|||
</field> |
|||
</record> |
|||
</odoo> |
@ -0,0 +1,27 @@ |
|||
# -*- 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: Jesni Banu (<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 leave_request_alias |
|||
from . import res_config |
|||
from . import web_planner |
|||
|
|||
|
@ -0,0 +1,73 @@ |
|||
# -*- 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: Jesni Banu (<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/>. |
|||
# |
|||
################################################################################### |
|||
import re |
|||
from datetime import datetime, timedelta |
|||
from odoo import models, api |
|||
from odoo.tools import email_split |
|||
|
|||
|
|||
class HrLeaveAlias(models.Model): |
|||
_inherit = 'hr.holidays' |
|||
|
|||
@api.model |
|||
def message_new(self, msg_dict, custom_values=None): |
|||
"""This function extracts required fields of hr.holidays from incoming mail then creating records""" |
|||
try: |
|||
if custom_values is None: |
|||
custom_values = {} |
|||
msg_subject = msg_dict.get('subject', '') |
|||
subject = re.search('LEAVE REQUEST', msg_subject) |
|||
if subject is not None: |
|||
email_address = email_split(msg_dict.get('email_from', False))[0] |
|||
employee = self.env['hr.employee'].sudo().search([ |
|||
'|', |
|||
('work_email', 'ilike', email_address), |
|||
('user_id.email', 'ilike', email_address) |
|||
], limit=1) |
|||
msg_body = msg_dict.get('body', '') |
|||
cleaner = re.compile('<.*?>') |
|||
clean_msg_body = re.sub(cleaner, '', msg_body) |
|||
date_list = re.findall(r'\d{2}/\d{2}/\d{4}', clean_msg_body) |
|||
if len(date_list) > 0: |
|||
date_from = date_list[0] |
|||
if len(date_list) > 1: |
|||
start_date = datetime.strptime(date_list[1], '%d/%m/%Y') |
|||
date_to = start_date + timedelta(days=0) |
|||
else: |
|||
start_date = datetime.strptime(date_list[0], '%d/%m/%Y') |
|||
date_to = start_date + timedelta(days=1) |
|||
no_of_days_temp = (datetime.strptime(str(date_to), "%Y-%m-%d %H:%M:%S") - |
|||
datetime.strptime(date_from, '%d/%m/%Y')).days |
|||
custom_values.update({ |
|||
'name': msg_subject.strip(), |
|||
'employee_id': employee.id, |
|||
'holiday_status_id': 1, |
|||
'date_from': date_from, |
|||
'date_to': date_to, |
|||
'no_of_days_temp': no_of_days_temp |
|||
}) |
|||
return super(HrLeaveAlias, self).message_new(msg_dict, custom_values) |
|||
except: |
|||
pass |
|||
|
|||
|
@ -0,0 +1,43 @@ |
|||
# -*- 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: Jesni Banu (<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 api, fields, models |
|||
|
|||
|
|||
class HrLeaveConfigSettings(models.TransientModel): |
|||
_name = 'hr.leave.config.settings' |
|||
_inherit = 'res.config.settings' |
|||
|
|||
alias_prefix = fields.Char(string='Default Alias Name for Leave', help='Default Alias Name for Leave') |
|||
alias_domain = fields.Char(string='Alias Domain', |
|||
default=lambda self: self.env["ir.config_parameter"].get_param("mail.catchall.domain")) |
|||
|
|||
@api.model |
|||
def get_default_alias_prefix(self, fields): |
|||
alias_name = self.env.ref('hr_leave_request_aliasing.mail_alias_leave').alias_name |
|||
return {'alias_prefix': alias_name} |
|||
|
|||
@api.multi |
|||
def set_default_alias_prefix(self): |
|||
for record in self: |
|||
self.env.ref('hr_leave_request_aliasing.mail_alias_leave').write({'alias_name': record.alias_prefix}) |
|||
|
@ -0,0 +1,43 @@ |
|||
# -*- 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: Jesni Banu (<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 api, models |
|||
|
|||
|
|||
class PlannerHrLeave(models.Model): |
|||
|
|||
_inherit = 'web.planner' |
|||
|
|||
@api.model |
|||
def _get_planner_application(self): |
|||
planner = super(PlannerHrLeave, self)._get_planner_application() |
|||
planner.append(['planner_hr_leave', 'Leave Planner']) |
|||
return planner |
|||
|
|||
@api.model |
|||
def _prepare_planner_hr_leave_data(self): |
|||
alias_record = self.env.ref('hr_leave_request_aliasing.mail_alias_leave') |
|||
return { |
|||
'alias_domain': alias_record.alias_domain, |
|||
'alias_name': alias_record.alias_name, |
|||
} |
|||
|
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 120 KiB |
After Width: | Height: | Size: 221 KiB |
After Width: | Height: | Size: 50 KiB |
After Width: | Height: | Size: 31 KiB |
@ -0,0 +1,62 @@ |
|||
<section class="oe_container"> |
|||
<div class="oe_row"> |
|||
<h2 class="oe_slogan">OpenHRMS</h2> |
|||
<h3 class="oe_slogan">Most advanced open source HR management software</h3> |
|||
</div> |
|||
</section> |
|||
<section class="oe_container"> |
|||
<div class="oe_row oe_spaced"> |
|||
<h2 class="oe_slogan">OH Leave Request Aliasing</h2> |
|||
<h3 class="oe_slogan">This Module Allows You To Create Leave Request Automatically Directly From Incoming Emails</h3> |
|||
<h4 class="oe_slogan"><a href="https://www.cybrosys.com">Cybrosys Technologies</a> </h4> |
|||
</div> |
|||
<div class="oe_row oe_spaced" style="padding-left:65px;"> |
|||
<h4>Features:</h4> |
|||
<div> |
|||
<span style="color:green;"> ☑ </span> Creating leave request automatically from incoming email.<br/> |
|||
<span style="color:green;"> ☑ </span> Option to set aliasing domain separately for leave request.<br/> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container oe_dark"> |
|||
<div class="oe_row oe_spaced"> |
|||
<div class="oe_picture"> |
|||
<h3 class="oe_slogan">Overview</h3> |
|||
<p class="oe_mt32 text-justify" style="text-align: center;"> |
|||
Email aliasing is a default feature in Odoo which allows the user to fetch contents to ERP records directly from incoming emails. |
|||
The feature is a type of automation. Since we can configure the E-mails to fetch contents directly. |
|||
So here we are providing one of the new module to create leave request automatically from incoming email. |
|||
</p> |
|||
</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="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> |
|||
</section> |
@ -0,0 +1,6 @@ |
|||
odoo.define('planner_hr_leave.planner', function (require) { |
|||
"use strict"; |
|||
|
|||
var planner = require('web.planner.common'); |
|||
|
|||
}); |
@ -0,0 +1,11 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<data> |
|||
<template id="assets_backend_expense" name="hr_leave assets" inherit_id="web.assets_backend"> |
|||
<xpath expr="." position="inside"> |
|||
<script type="text/javascript" src="/hr_leave_request_aliasing/static/src/js/web_planner_hr_leave.js"></script> |
|||
</xpath> |
|||
</template> |
|||
</data> |
|||
</odoo> |
|||
|
@ -0,0 +1,9 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<record id="mail_alias_leave" model="mail.alias"> |
|||
<field name="alias_name">leave</field> |
|||
<field name="alias_model_id" ref="model_hr_holidays"/> |
|||
<field name="alias_user_id" ref="base.user_root"/> |
|||
<field name="alias_contact">employees</field> |
|||
</record> |
|||
</odoo> |
@ -0,0 +1,50 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<data> |
|||
<record id="view_hr_leave_configuration" model="ir.ui.view"> |
|||
<field name="name">Configure Leave</field> |
|||
<field name="model">hr.leave.config.settings</field> |
|||
<field name="inherit_id" eval="False"/> |
|||
<field name="arch" type="xml"> |
|||
<form class="oe_form_configuration"> |
|||
<header> |
|||
<button string="Apply" type="object" name="execute" class="oe_highlight"/> |
|||
<button string="Cancel" type="object" name="cancel" class="oe_link" special="cancel"/> |
|||
</header> |
|||
<group string="Leaves" name="config_alias"> |
|||
<label for="id" string="Leave Email Alias"/> |
|||
<div> |
|||
<div attrs="{'invisible': [('alias_domain', 'in', ['localhost', '', False])]}"> |
|||
<p class="text-muted"> |
|||
You can setup a generic email alias to create |
|||
incoming leave request easily. Write an email with the desired |
|||
format to create leave request in one click. |
|||
Format:- Start subject with 'LEAVE REQUEST'. After your mail content mention |
|||
'Date From:' and 'Date To:'. |
|||
</p> |
|||
<field name="alias_prefix" class="oe_inline"/> |
|||
<span>@</span> |
|||
<field name="alias_domain" class="oe_inline" readonly="1"/> |
|||
</div> |
|||
<div attrs="{'invisible': [('alias_domain', 'not in', ['localhost', '', False])]}"> |
|||
<button type="action" |
|||
name="base_setup.action_general_configuration" |
|||
string="Setup your domain alias" class="oe_link"/> |
|||
</div> |
|||
</div> |
|||
</group> |
|||
</form> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="action_hr_leave_configuration" model="ir.actions.act_window"> |
|||
<field name="name">Configure Leave</field> |
|||
<field name="res_model">hr.leave.config.settings</field> |
|||
<field name="view_mode">form</field> |
|||
<field name="target">inline</field> |
|||
</record> |
|||
|
|||
<menuitem id="menu_hr_leave_global_settings" name="Settings" |
|||
parent="hr_holidays.menu_hr_holidays_root" sequence="96" action="action_hr_leave_configuration" groups="base.group_system"/> |
|||
</data> |
|||
</odoo> |
Loading…
Reference in new issue