-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
151 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
.. |company| replace:: ADHOC SA | ||
|
||
.. |company_logo| image:: https://raw.githubusercontent.com/ingadhoc/maintainer-tools/master/resources/adhoc-logo.png | ||
:alt: ADHOC SA | ||
:target: https://www.adhoc.com.ar | ||
|
||
.. |icon| image:: https://raw.githubusercontent.com/ingadhoc/maintainer-tools/master/resources/adhoc-icon.png | ||
|
||
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png | ||
:target: https://www.gnu.org/licenses/agpl | ||
:alt: License: AGPL-3 | ||
|
||
======================== | ||
Mail Activity Automation | ||
======================== | ||
|
||
* This module incorporates the functionality of automatically executing the activity, whether it is sending an email or marking Done. | ||
|
||
Installation | ||
============ | ||
|
||
To install this module, you need to: | ||
|
||
#. Just install | ||
|
||
Configuration | ||
============= | ||
|
||
To configure this module, you need to: | ||
|
||
#. In the activities type configure with "run automatically". | ||
|
||
|
||
Usage | ||
===== | ||
|
||
To use this module, you need to: | ||
|
||
#. Scheduler an activity using the activity type with "Run automatically" on. | ||
|
||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas | ||
:alt: Try me on Runbot | ||
:target: http://runbot.adhoc.com.ar/ | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues | ||
<https://github.com/ingadhoc/miscellaneous/issues>`_. In case of trouble, please | ||
check there if your issue has already been reported. If you spotted it first, | ||
help us smashing it by providing a detailed and welcomed feedback. | ||
|
||
Credits | ||
======= | ||
|
||
Images | ||
------ | ||
|
||
* |company| |icon| | ||
|
||
Contributors | ||
------------ | ||
|
||
Maintainer | ||
---------- | ||
|
||
|company_logo| | ||
|
||
This module is maintained by the |company|. | ||
|
||
To contribute to this module, please visit https://www.adhoc.com.ar. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
{ | ||
'name': 'Mail Activity Automation', | ||
'version': "16.0.1.0.0", | ||
'category': 'Communications', | ||
'sequence': 14, | ||
'summary': '', | ||
'author': 'ADHOC SA', | ||
'website': 'www.adhoc.com.ar', | ||
'license': 'AGPL-3', | ||
'images': [ | ||
], | ||
'depends': [ | ||
'mail', | ||
], | ||
'data': [ | ||
'views/mail_activity_type_views.xml', | ||
'data/ir_cron_data.xml', | ||
], | ||
'installable': True, | ||
'auto_install': False, | ||
'application': False, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
<record id="run_activities_automatically" model="ir.cron"> | ||
<field name="name">Run Activities Automatically</field> | ||
<field name="model_id" ref="mail.model_mail_activity"/> | ||
<field name="state">code</field> | ||
<field name="code">model._cron_run_activities()</field> | ||
<field name="active" eval="True"/> | ||
<field name="interval_number">1</field> | ||
<field name="interval_type">hours</field> | ||
<field name="numbercall">-1</field> | ||
</record> | ||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from . import mail_activity | ||
from . import mail_activity_type |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from odoo import models | ||
import datetime | ||
|
||
|
||
class MailActivity(models.Model): | ||
_inherit = "mail.activity" | ||
|
||
def _cron_run_activities(self): | ||
activities = self.search([('activity_type_id.run_automatically', '=', True), ('date_deadline', '<=', datetime.date.today())]) | ||
for activity in activities: | ||
activity.with_context(from_bot=True).action_done_schedule_next() | ||
|
||
def _action_done(self, feedback=False, attachment_ids=None): | ||
if self._context.get('from_bot') and self.activity_type_id.mail_template_ids: | ||
for mail_template in self.activity_type_id.mail_template_ids: | ||
self.env[self.res_model].browse(self.res_id).message_post_with_template(mail_template.id) | ||
return super()._action_done(feedback=feedback, attachment_ids=attachment_ids) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from odoo import models, fields, api | ||
|
||
|
||
class MailActivityType(models.Model): | ||
_inherit = "mail.activity.type" | ||
|
||
run_automatically = fields.Boolean(help="Si marca esta opción, llegada la fecha de vencimiento, se enviará la plantilla seleccionada y se marcará la actividad como realizado.") | ||
|
||
|
||
|
||
|
13 changes: 13 additions & 0 deletions
13
mail_activity_automation/views/mail_activity_type_views.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version='1.0' encoding='utf-8'?> | ||
<odoo> | ||
<record id="mail_activity_type_view_form" model="ir.ui.view"> | ||
<field name="name">mail.activity.type.view.form</field> | ||
<field name="model">mail.activity.type</field> | ||
<field name="inherit_id" ref="mail.mail_activity_type_view_form"/> | ||
<field name="arch" type="xml"> | ||
<field name="decoration_type" position="after"> | ||
<field name="run_automatically"/> | ||
</field> | ||
</field> | ||
</record> | ||
</odoo> |