Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions scheduler_error_mailer/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

======================
Scheduler Error Mailer
======================

This module adds the possibility to send an e-mail when a scheduler raises
an error.

Configuration
=============

To configure this module, you need to:

#. Go to Settings -> Technical -> Automation -> Scheduled Actions
#. Choose the scheduled Actions you want to send the error email and select the E-mail Template in the Error E-mail Template field.

Usage
=====

To use this module, you need to:

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/149/12.0

Bug Tracker
===========

Bugs are tracked on `GitHub Issues
<https://github.com/OCA/server-tools/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
------

* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.

Contributors
------------

* Sébastien BEAU <sebastien.beau@akretion.com>
* David Beal <bealdavid@gmail.com>
* Alexis de Lattre <alexis.delattre@akretion.com>
* Sodexis <dev@sodexis.com>
* Achraf Mhadhbi <machraf@bloopark.de>


Maintainer
----------

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

This module is maintained by the OCA.

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

To contribute to this module, please visit https://odoo-community.org.
5 changes: 5 additions & 0 deletions scheduler_error_mailer/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# © 2012-2013 Akretion Sébastien BEAU,David Beal,Alexis de Lattre
# © 2016 Sodexis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import models
21 changes: 21 additions & 0 deletions scheduler_error_mailer/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# © 2012-2013 Akretion Sébastien BEAU,David Beal,Alexis de Lattre
# © 2016 Sodexis
# © 2018 bloopark systems (<http://bloopark.de>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
'name': 'Scheduler Error Mailer',
'version': '12.0.1.0.0',
'category': 'Extra Tools',
'license': 'AGPL-3',
'author': "Akretion,Sodexis,Odoo Community Association (OCA)",
'website': 'http://www.akretion.com/',
'depends': ['mail'],
'data': [
'data/ir_cron_email_tpl.xml',
'views/ir_cron.xml',
],
'demo': ['demo/ir_cron_demo.xml'],
'images': ['images/scheduler_error_mailer.jpg'],
'installable': True,
}
48 changes: 48 additions & 0 deletions scheduler_error_mailer/data/ir_cron_email_tpl.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>

<odoo>
<data noupdate="1">

<!-- Error Email template -->
<record id="scheduler_error_mailer" model="mail.template">
<field name="name">Scheduler Error</field>
<field name="email_from">${object.user_id.email or ''}</field>
<field name="email_to">${object.user_id.email or ''}</field>
<field name="subject">[DB ${ctx.get('dbname')}] Scheduler '${object.name or ''}' FAILED</field>
<field name="model_id" ref="base.model_ir_cron"/>
<field name="auto_delete" eval="True"/>
<field name="body_html">
<![CDATA[
<div style="font-family: 'Lucida Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; ">

<p>Odoo tried to run the scheduler <em>${object.name or ''}</em> in the database <em>${ctx.get('dbname')}</em> but it failed. Here is the error message :</p>

<strong>
${ctx.get('job_exception') and ctx.get('job_exception').value or 'Failed to get the error message from the context.'}
</strong>

<p>You may check the logs of the Odoo server to get more information about this failure.</p>

<p>Properties of the scheduler <em>${object.name or ''}</em> :</p>
<ul>
<li>Model : ${object.model or ''}</li>
<li>Method : ${object.function or ''}</li>
<li>Arguments : ${object.args or ''}</li>
<li>Interval : ${object.interval_number or '0'} ${object.interval_type or ''}</li>
<li>Number of calls : ${object.numbercall or '0'}</li>
<li>Repeat missed : ${object.doall}</li>
<li>User : ${object.user_id.name or ''}</li>
</ul>

<p>
-- <br/>
Automatic e-mail sent by Odoo. Do not reply.<br/>
Database : ${ctx.get('dbname')}
</p>
</div>
]]>
</field>
</record>

</data>
</odoo>
29 changes: 29 additions & 0 deletions scheduler_error_mailer/demo/ir_cron_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
scheduler_error_mailer for Odoo
Copyright (C) 2012-2013 Akretion Sébastien BEAU,David Beal,Alexis de Lattre
Copyright (C) 2016 Sodexis
Copyright (C) 2018 bloopark systems (<http://bloopark.de>)
The licence is in the file __openerp__.py
-->

<odoo>
<data noupdate="1">

<record id="test_scheduler_error_mailer" model="ir.cron">
<field name="name">Test Scheduler Error Mailer</field>
<field name="active" eval="False"/>
<field name="user_id" ref="base.user_root"/>
<field name="interval_number">1</field>
<field name="interval_type">hours</field>
<field name="numbercall">-1</field>
<!-- don't limit the number of calls -->
<field name="doall" eval="True"/>
<field name="model_id" ref="model_ir_cron"/>
<field name="state">code</field>
<field name="code">model._test_scheduler_failure()</field>
<field name="email_template_id" ref="scheduler_error_mailer.scheduler_error_mailer"/>
</record>

</data>
</odoo>
120 changes: 120 additions & 0 deletions scheduler_error_mailer/i18n/de.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * scheduler_error_mailer
#
# Translators:
# Niki Waibel <niki.waibel@gmail.com>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-02-08 03:37+0000\n"
"PO-Revision-Date: 2017-02-08 03:37+0000\n"
"Last-Translator: Niki Waibel <niki.waibel@gmail.com>, 2017\n"
"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#. module: scheduler_error_mailer
#: model:mail.template,body_html:scheduler_error_mailer.scheduler_error_mailer
msgid ""
"\n"
" \n"
"<div style=\"font-family: 'Lucida Grande', Ubuntu, Arial, Verdana, sans-"
"serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; \">\n"
"\n"
"<p>Odoo tried to run the scheduler <em>${object.name or ''}</em> in the "
"database <em>${ctx.get('dbname')}</em> but it failed. Here is the error "
"message :</p>\n"
"\n"
"<strong>\n"
"${ctx.get('job_exception') and ctx.get('job_exception').value or 'Failed to "
"get the error message from the context.'}\n"
"</strong>\n"
"\n"
"<p>You may check the logs of the Odoo server to get more information about "
"this failure.</p>\n"
"\n"
"<p>Properties of the scheduler <em>${object.name or ''}</em> :</p>\n"
"<ul>\n"
"<li>Model : ${object.model or ''}</li>\n"
"<li>Method : ${object.function or ''}</li>\n"
"<li>Arguments : ${object.args or ''}</li>\n"
"<li>Interval : ${object.interval_number or '0'} ${object.interval_type or ''}"
"</li>\n"
"<li>Number of calls : ${object.numbercall or '0'}</li>\n"
"<li>Repeat missed : ${object.doall}</li>\n"
"<li>User : ${object.user_id.name or ''}</li>\n"
"</ul>\n"
"\n"
"<p>\n"
"-- <br/>\n"
"Automatic e-mail sent by Odoo. Do not reply.<br/>\n"
"Database : ${ctx.get('dbname')}\n"
"</p>\n"
"</div>\n"
" \n"
" "
msgstr ""

#. module: scheduler_error_mailer
#: model:ir.model.fields,field_description:scheduler_error_mailer.field_ir_cron_channel_ids
#: model:ir.model.fields,field_description:scheduler_error_mailer.field_nsca_check_channel_ids
msgid "Add Channels"
msgstr ""

#. module: scheduler_error_mailer
#: model:ir.model.fields,field_description:scheduler_error_mailer.field_ir_cron_partner_ids
#: model:ir.model.fields,field_description:scheduler_error_mailer.field_nsca_check_partner_ids
msgid "Add Followers"
msgstr ""

#. module: scheduler_error_mailer
#: model:ir.model.fields,field_description:scheduler_error_mailer.field_ir_cron_template_id
#: model:ir.model.fields,field_description:scheduler_error_mailer.field_nsca_check_template_id
#, fuzzy
msgid "Email Template"
msgstr "Fehler e-Mail Vorlage"

#. module: scheduler_error_mailer
#: model:ir.model.fields,field_description:scheduler_error_mailer.field_ir_cron_email_template_id
#: model:ir.model.fields,field_description:scheduler_error_mailer.field_nsca_check_email_template_id
msgid "Error E-mail Template"
msgstr "Fehler e-Mail Vorlage"

#. module: scheduler_error_mailer
#: model:ir.model,name:scheduler_error_mailer.model_ir_cron
msgid "Scheduled Actions"
msgstr ""

#. module: scheduler_error_mailer
#: model:ir.model.fields,help:scheduler_error_mailer.field_ir_cron_email_template_id
#: model:ir.model.fields,help:scheduler_error_mailer.field_nsca_check_email_template_id
msgid "Select the email template that will be sent when this scheduler fails."
msgstr ""
"Wähle die e-Mail Vorlage welche bei einem Fehler dieses Schedulers gesendet "
"wird."

#. module: scheduler_error_mailer
#: code:addons/scheduler_error_mailer/models/ir_cron.py:55
#, python-format
msgid "Task failure with UID = %d."
msgstr "Task Fehler von UID = %d."

#. module: scheduler_error_mailer
#: model:ir.actions.server,name:scheduler_error_mailer.test_scheduler_error_mailer_ir_actions_server
#: model:ir.cron,cron_name:scheduler_error_mailer.test_scheduler_error_mailer
#: model:ir.cron,name:scheduler_error_mailer.test_scheduler_error_mailer
msgid "Test Scheduler Error Mailer"
msgstr ""

#. module: scheduler_error_mailer
#: model:mail.template,subject:scheduler_error_mailer.scheduler_error_mailer
msgid "[DB ${ctx.get('dbname')}] Scheduler '${object.name or ''}' FAILED"
msgstr "[DB ${ctx.get('dbname')}] Scheduler '${object.name or ''}' FEHLER"

#~ msgid "ir.cron"
#~ msgstr "ir.cron"
Loading