Browse Source

[ADD] Initial Commit

pull/90/merge
Sreejith P 7 years ago
parent
commit
1a6c34aeaf
  1. 58
      task_deadline_reminder/README.rst
  2. 23
      task_deadline_reminder/__init__.py
  3. 40
      task_deadline_reminder/__manifest__.py
  4. 46
      task_deadline_reminder/data/deadline_reminder_action_data.xml
  5. 5
      task_deadline_reminder/models/__init__.py
  6. 37
      task_deadline_reminder/models/deadline_reminder.py
  7. BIN
      task_deadline_reminder/static/description/banner.jpg
  8. BIN
      task_deadline_reminder/static/description/cybro_logo.png
  9. BIN
      task_deadline_reminder/static/description/icon.png
  10. 76
      task_deadline_reminder/static/description/index.html
  11. BIN
      task_deadline_reminder/static/description/mail.png
  12. BIN
      task_deadline_reminder/static/description/project_task_form.jpg
  13. BIN
      task_deadline_reminder/static/description/scheduled_action_form.png
  14. 16
      task_deadline_reminder/views/deadline_reminder_cron.xml
  15. 17
      task_deadline_reminder/views/deadline_reminder_view.xml

58
task_deadline_reminder/README.rst

@ -0,0 +1,58 @@
Task DeadLine Reminder v11
==========================
This module extends the functionality of project module to allow to send deadline reminder emails on task deadline day.
Configuration
=============
By default, a cron job named "Task DeadLine Reminder" will be created while installing this module.
This cron job can be found in:
**Settings > Technical > Automation > Scheduled Actions**
This job runs daily by default.
Usage
=====
To use this functionality, you need to:
#. Create a project to which the new tasks will be related.
#. Add a name, deadline date, who the task will be assigned to, etc...
#. In order to send email reminder to responsible user,you have to set reminder box (Project > Task > Reminder )
#. Go to the Scheduled Action(Settings > Technical > Automation > Scheduled Action) and edit the time at which Deadline Reminder Action is to be done
The cron job will do the rest.
Installation
============
- www.odoo.com/documentation/11.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 <www.cybrosys.com>
Author
------
* Developer v9: Saritha @ cybrosys
* Developer v10, v11: Niyas Raphy @ cybrosys
Maintainer
----------
This module is maintained by Cybrosys Technologies.
For support and more information, please visit https://www.cybrosys.com.

23
task_deadline_reminder/__init__.py

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

40
task_deadline_reminder/__manifest__.py

@ -0,0 +1,40 @@
# -*- coding: utf-8 -*-
###################################################################################
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2018-TODAY Cybrosys Technologies (<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': "Task Deadline Reminder",
'version': "11.0.1.0.0",
'author': 'Cybrosys Techno Solutions',
'company': 'Cybrosys Techno Solutions',
'website': 'https://www.cybrosys.com',
'summary': '''Automatically Send Mail To Responsible User if Deadline Of Task is Today''',
'description': '''Automatically Send Mail To Responsible User if Deadline Of Task is Today''',
'category': "Project",
'depends': ['project'],
'license': 'AGPL-3',
'data': [
'views/deadline_reminder_view.xml',
'views/deadline_reminder_cron.xml',
'data/deadline_reminder_action_data.xml'
],
'demo': [],
'images': ['static/description/banner.jpg'],
'installable': True,
'auto_install': False
}

46
task_deadline_reminder/data/deadline_reminder_action_data.xml

@ -0,0 +1,46 @@
<?xml version="1.0" ?>
<odoo>
<data noupdate="1">
<record id="email_template_edi_deadline_reminder" model="mail.template">
<field name="name">Deadline Reminder...!!</field>
<field name="email_from">${object.company_id.name}&lt;${object.company_id.email}&gt;</field>
<field name="email_to">${object.user_id.email}</field>
<field name="subject">Today Due Task -${object.date_deadline or 'n/a' }</field>
<field name="model_id" ref="task_deadline_reminder.model_project_task" />
<field name="auto_delete" eval="True" />
<field name="body_html"><![CDATA[
<div class="page">
<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; ">
<p>Hello ${object.user_id.name},</p>
<p> This Email Is To Remind You That You Have Task As Below Listed Which Are Due On Today. </p>
</div>
<div>
<table class="table table-condensed">
<thead>
<tr>
<th style="background-color:#9b9da0 !important;">Task</th>
<th style="background-color:#9b9da0 !important;">Project</th>
<th style="background-color:#9b9da0 !important;">Deadline</th>
<th style="background-color:#9b9da0 !important;">Assigned To</th>
<th style="background-color:#9b9da0 !important;">Link</th>
</tr>
</thead>
<tbody>
<tr>
<td><span>${object.name}</span></td>
<td><span>${object.project_id.name}</span></td>
<td><span>${object.date_deadline}</span></td>
<td><span>${object.user_id.name}</span></td>
<td><a href=/web/login/>View Now</a></td>
</tr>
</tbody>
</table>
</div>
</div>
]]>
</field>
</record>
</data>
</odoo>

5
task_deadline_reminder/models/__init__.py

@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
from . import deadline_reminder

37
task_deadline_reminder/models/deadline_reminder.py

@ -0,0 +1,37 @@
# -*- coding: utf-8 -*-
import datetime
from datetime import datetime
from odoo import SUPERUSER_ID
from odoo import api, fields, models, _
class DeadLineReminder(models.Model):
_inherit = "project.task"
task_reminder = fields.Boolean("Reminder")
@api.model
def _cron_deadline_reminder(self):
su_id = self.env['res.partner'].browse(SUPERUSER_ID)
for task in self.env['project.task'].search([('date_deadline', '!=', None),
('task_reminder', '=', True), ('user_id', '!=', None)]):
reminder_date = datetime.strptime(task.date_deadline, '%Y-%m-%d').date()
today = datetime.now().date()
if reminder_date == today and task:
template_id = self.env['ir.model.data'].get_object_reference(
'task_deadline_reminder',
'email_template_edi_deadline_reminder')[1]
if template_id:
email_template_obj = self.env['mail.template'].browse(template_id)
values = email_template_obj.generate_email(task.id, fields=None)
values['email_from'] = su_id.email
values['email_to'] = task.user_id.email
values['res_id'] = False
mail_mail_obj = self.env['mail.mail']
msg_id = mail_mail_obj.create(values)
if msg_id:
msg_id.send()
return True

BIN
task_deadline_reminder/static/description/banner.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

BIN
task_deadline_reminder/static/description/cybro_logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
task_deadline_reminder/static/description/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

76
task_deadline_reminder/static/description/index.html

@ -0,0 +1,76 @@
<!DOCTYPE html>
<html>
<head></head>
<body>
<section class="oe_container">
<div class="oe_row oe_spaced">
<h2 class="oe_slogan">Task DeadLine Reminder</h2>
<div class="oe_span12">
<p class="oe_mt32"><center>
This module send auto reminder to responsible user of task if deadline = Today. Cron job will
run everyday and search for task which due today and send reminder email to employee.
</center></p>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row">
<h3 class="oe_slogan">Project Task Form - Configuration of Task Deadline Reminder</h3>
<div class="oe_span12">
<p class='oe_mt32'><center>
If set this box then only this task will be consider for reminder.
</center></p>
</div>
<div class="oe_span12">
<div class="oe_demo oe_picture oe_screenshot">
<img src="project_task_form.jpg">
</div>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row">
<h3 class="oe_slogan">Automation Scheduled Action - Cron Job</h3>
<div class="oe_span12">
<div class="oe_demo oe_picture oe_screenshot">
<img src="scheduled_action_form.png">
</div>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row">
<h3 class="oe_slogan">Email to User/Employee</h3>
<div class="oe_span12">
<p class='oe_mt32'><center>
View Now link will allow user to jump to related task directly. This email will group all tasks which are deadline today for that user and send summary table to user/employee by email.
</center></p>
</div>
<div class="oe_span12">
<div class="oe_demo oe_picture oe_screenshot">
<img src="mail.png">
</div>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<h2 class="oe_slogan" style="margin-top:20px;" >Need Any Help?</h2>
<div class="oe_slogan" style="margin-top:10px !important;">
<a class="btn btn-primary btn-lg mt8"
style="color: #FFFFFF !important;" 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;"
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;"
href="http://www.cybrosys.com/odoo-customization-and-installation/"><i
class="fa fa-check-square"></i> Request Customization </a>
</div>
<img src="cybro_logo.png" style="width: 190px; margin-bottom: 20px;" class="center-block">
</section>
</body>
</html>

BIN
task_deadline_reminder/static/description/mail.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

BIN
task_deadline_reminder/static/description/project_task_form.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 KiB

BIN
task_deadline_reminder/static/description/scheduled_action_form.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

16
task_deadline_reminder/views/deadline_reminder_cron.xml

@ -0,0 +1,16 @@
<?xml version="1.0" encoding='UTF-8'?>
<odoo>
<record id="availability_create_cron" model="ir.cron">
<field name="name">Task DeadLine Reminder</field>
<field name="model_id" ref="project.model_project_task"/>
<field name="state">code</field>
<field name="code">model._cron_deadline_reminder()</field>
<field name="user_id" ref="base.user_root" />
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field eval="False" name="doall" />
</record>
</odoo>

17
task_deadline_reminder/views/deadline_reminder_view.xml

@ -0,0 +1,17 @@
<?xml version="1.0" encoding='UTF-8'?>
<odoo>
<data>
<record model="ir.ui.view" id="task_deadline_reminder_form">
<field name="name">ProjectTaskRemainder</field>
<field name="model">project.task</field>
<field name="inherit_id" ref="project.view_task_form2"/>
<field name="arch" type="xml">
<field name="tag_ids" position="after">
<field name="task_reminder"/>
</field>
</field>
</record>
</data>
</odoo>
Loading…
Cancel
Save