diff --git a/scheduler_error_mailer/README.rst b/scheduler_error_mailer/README.rst new file mode 100644 index 000000000..a6af6cc70 --- /dev/null +++ b/scheduler_error_mailer/README.rst @@ -0,0 +1,72 @@ +.. 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/11.0 + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 `_. + +Contributors +------------ + +* Sébastien BEAU +* David Beal +* Alexis de Lattre +* Sodexis +* Achraf Mhadhbi + +* `Tecnativa `_: + + * Cristina Martin R. + + +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. diff --git a/scheduler_error_mailer/__init__.py b/scheduler_error_mailer/__init__.py new file mode 100644 index 000000000..69f7babdf --- /dev/null +++ b/scheduler_error_mailer/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import models diff --git a/scheduler_error_mailer/__manifest__.py b/scheduler_error_mailer/__manifest__.py new file mode 100644 index 000000000..92e61ac59 --- /dev/null +++ b/scheduler_error_mailer/__manifest__.py @@ -0,0 +1,22 @@ +# Copyright 2012-2013 Akretion Sébastien BEAU,David Beal,Alexis de Lattre +# Copyright 2016 Sodexis +# Copyright 2018 bloopark systems () +# Copyright 2019 Tecnativa - Cristina Martin R. +# 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': 'https://github.com/OCA/server-tools', + '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, +} diff --git a/scheduler_error_mailer/data/ir_cron_email_tpl.xml b/scheduler_error_mailer/data/ir_cron_email_tpl.xml new file mode 100644 index 000000000..a6696e59f --- /dev/null +++ b/scheduler_error_mailer/data/ir_cron_email_tpl.xml @@ -0,0 +1,48 @@ + + + + + + + + Scheduler Error + ${object.user_id.email or ''} + ${object.user_id.email or ''} + [DB ${ctx.get('dbname')}] Scheduler '${object.name or ''}' FAILED + + + + + +

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

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

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

+ +

Properties of the scheduler ${object.name or ''} :

+
    +
  • Model : ${object.model or ''}
  • +
  • Method : ${object.function or ''}
  • +
  • Arguments : ${object.args or ''}
  • +
  • Interval : ${object.interval_number or '0'} ${object.interval_type or ''}
  • +
  • Number of calls : ${object.numbercall or '0'}
  • +
  • Repeat missed : ${object.doall}
  • +
  • User : ${object.user_id.name or ''}
  • +
+ +

+--
+Automatic e-mail sent by Odoo. Do not reply.
+Database : ${ctx.get('dbname')} +

+ + ]]> +
+
+ +
+
diff --git a/scheduler_error_mailer/demo/ir_cron_demo.xml b/scheduler_error_mailer/demo/ir_cron_demo.xml new file mode 100644 index 000000000..80e3c88cb --- /dev/null +++ b/scheduler_error_mailer/demo/ir_cron_demo.xml @@ -0,0 +1,29 @@ + + + + + + + + Test Scheduler Error Mailer + + + 1 + hours + -1 + + + + code + model._test_scheduler_failure() + + + + + diff --git a/scheduler_error_mailer/i18n/de.po b/scheduler_error_mailer/i18n/de.po new file mode 100644 index 000000000..cc4113013 --- /dev/null +++ b/scheduler_error_mailer/i18n/de.po @@ -0,0 +1,120 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * scheduler_error_mailer +# +# Translators: +# Niki Waibel , 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 , 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" +"
\n" +"\n" +"

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

\n" +"\n" +"\n" +"${ctx.get('job_exception') and ctx.get('job_exception').value or 'Failed to " +"get the error message from the context.'}\n" +"\n" +"\n" +"

You may check the logs of the Odoo server to get more information about " +"this failure.

\n" +"\n" +"

Properties of the scheduler ${object.name or ''} :

\n" +"
    \n" +"
  • Model : ${object.model or ''}
  • \n" +"
  • Method : ${object.function or ''}
  • \n" +"
  • Arguments : ${object.args or ''}
  • \n" +"
  • Interval : ${object.interval_number or '0'} ${object.interval_type or ''}" +"
  • \n" +"
  • Number of calls : ${object.numbercall or '0'}
  • \n" +"
  • Repeat missed : ${object.doall}
  • \n" +"
  • User : ${object.user_id.name or ''}
  • \n" +"
\n" +"\n" +"

\n" +"--
\n" +"Automatic e-mail sent by Odoo. Do not reply.
\n" +"Database : ${ctx.get('dbname')}\n" +"

\n" +"
\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" diff --git a/scheduler_error_mailer/i18n/es.po b/scheduler_error_mailer/i18n/es.po new file mode 100644 index 000000000..d283d8f4d --- /dev/null +++ b/scheduler_error_mailer/i18n/es.po @@ -0,0 +1,121 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * scheduler_error_mailer +# +# Translators: +# OCA Transbot , 2017 +# Fernando Lara , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-02-22 00:55+0000\n" +"PO-Revision-Date: 2017-02-22 00:55+0000\n" +"Last-Translator: Fernando Lara , 2017\n" +"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n" +"Language: es\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" +"
\n" +"\n" +"

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

\n" +"\n" +"\n" +"${ctx.get('job_exception') and ctx.get('job_exception').value or 'Failed to " +"get the error message from the context.'}\n" +"\n" +"\n" +"

You may check the logs of the Odoo server to get more information about " +"this failure.

\n" +"\n" +"

Properties of the scheduler ${object.name or ''} :

\n" +"
    \n" +"
  • Model : ${object.model or ''}
  • \n" +"
  • Method : ${object.function or ''}
  • \n" +"
  • Arguments : ${object.args or ''}
  • \n" +"
  • Interval : ${object.interval_number or '0'} ${object.interval_type or ''}" +"
  • \n" +"
  • Number of calls : ${object.numbercall or '0'}
  • \n" +"
  • Repeat missed : ${object.doall}
  • \n" +"
  • User : ${object.user_id.name or ''}
  • \n" +"
\n" +"\n" +"

\n" +"--
\n" +"Automatic e-mail sent by Odoo. Do not reply.
\n" +"Database : ${ctx.get('dbname')}\n" +"

\n" +"
\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 "Plantilla de correo electrónico de error" + +#. 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 "Plantilla de correo electrónico de error" + +#. 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 "" +"Seleccione la plantilla de correo electrónico que se enviará cuando falla " +"este planificador." + +#. module: scheduler_error_mailer +#: code:addons/scheduler_error_mailer/models/ir_cron.py:55 +#, python-format +msgid "Task failure with UID = %d." +msgstr "Error de Tarea con 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 "" + +#~ msgid "ir.cron" +#~ msgstr "ir.cron" diff --git a/scheduler_error_mailer/i18n/hr.po b/scheduler_error_mailer/i18n/hr.po new file mode 100644 index 000000000..3641fe18d --- /dev/null +++ b/scheduler_error_mailer/i18n/hr.po @@ -0,0 +1,118 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * scheduler_error_mailer +# +# Translators: +# Bole , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-03-02 18:41+0000\n" +"PO-Revision-Date: 2018-03-02 18:41+0000\n" +"Last-Translator: Bole , 2018\n" +"Language-Team: Croatian (https://www.transifex.com/oca/teams/23907/hr/)\n" +"Language: hr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" + +#. module: scheduler_error_mailer +#: model:mail.template,body_html:scheduler_error_mailer.scheduler_error_mailer +msgid "" +"\n" +" \n" +"
\n" +"\n" +"

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

\n" +"\n" +"\n" +"${ctx.get('job_exception') and ctx.get('job_exception').value or 'Failed to " +"get the error message from the context.'}\n" +"\n" +"\n" +"

You may check the logs of the Odoo server to get more information about " +"this failure.

\n" +"\n" +"

Properties of the scheduler ${object.name or ''} :

\n" +"
    \n" +"
  • Model : ${object.model or ''}
  • \n" +"
  • Method : ${object.function or ''}
  • \n" +"
  • Arguments : ${object.args or ''}
  • \n" +"
  • Interval : ${object.interval_number or '0'} ${object.interval_type or ''}" +"
  • \n" +"
  • Number of calls : ${object.numbercall or '0'}
  • \n" +"
  • Repeat missed : ${object.doall}
  • \n" +"
  • User : ${object.user_id.name or ''}
  • \n" +"
\n" +"\n" +"

\n" +"--
\n" +"Automatic e-mail sent by Odoo. Do not reply.
\n" +"Database : ${ctx.get('dbname')}\n" +"

\n" +"
\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 +msgid "Email Template" +msgstr "" + +#. 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 "" + +#. 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 "" + +#. module: scheduler_error_mailer +#: code:addons/scheduler_error_mailer/models/ir_cron.py:55 +#, python-format +msgid "Task failure with UID = %d." +msgstr "" + +#. 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 "" + +#~ msgid "ir.cron" +#~ msgstr "ir.cron" diff --git a/scheduler_error_mailer/i18n/pt_BR.po b/scheduler_error_mailer/i18n/pt_BR.po new file mode 100644 index 000000000..6f91016b9 --- /dev/null +++ b/scheduler_error_mailer/i18n/pt_BR.po @@ -0,0 +1,117 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * scheduler_error_mailer +# +# Translators: +# OCA Transbot , 2016 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-08-06 02:49+0000\n" +"PO-Revision-Date: 2016-08-06 02:49+0000\n" +"Last-Translator: OCA Transbot , 2016\n" +"Language-Team: Portuguese (Brazil) (https://www.transifex.com/oca/" +"teams/23907/pt_BR/)\n" +"Language: pt_BR\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" +"
\n" +"\n" +"

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

\n" +"\n" +"\n" +"${ctx.get('job_exception') and ctx.get('job_exception').value or 'Failed to " +"get the error message from the context.'}\n" +"\n" +"\n" +"

You may check the logs of the Odoo server to get more information about " +"this failure.

\n" +"\n" +"

Properties of the scheduler ${object.name or ''} :

\n" +"
    \n" +"
  • Model : ${object.model or ''}
  • \n" +"
  • Method : ${object.function or ''}
  • \n" +"
  • Arguments : ${object.args or ''}
  • \n" +"
  • Interval : ${object.interval_number or '0'} ${object.interval_type or ''}" +"
  • \n" +"
  • Number of calls : ${object.numbercall or '0'}
  • \n" +"
  • Repeat missed : ${object.doall}
  • \n" +"
  • User : ${object.user_id.name or ''}
  • \n" +"
\n" +"\n" +"

\n" +"--
\n" +"Automatic e-mail sent by Odoo. Do not reply.
\n" +"Database : ${ctx.get('dbname')}\n" +"

\n" +"
\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 "Modelo de Erro de E-mail" + +#. 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 "Modelo de Erro de E-mail" + +#. 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 "" +"Selecione o modelo de email que será enviado quando o agendador falhar." + +#. module: scheduler_error_mailer +#: code:addons/scheduler_error_mailer/models/ir_cron.py:55 +#, python-format +msgid "Task failure with UID = %d." +msgstr "Tarefa falhou com 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')}] Agendador '${object.name or ''}' FALHOU" diff --git a/scheduler_error_mailer/i18n/scheduler_error_mailer.pot b/scheduler_error_mailer/i18n/scheduler_error_mailer.pot new file mode 100644 index 000000000..1ba9cdbfc --- /dev/null +++ b/scheduler_error_mailer/i18n/scheduler_error_mailer.pot @@ -0,0 +1,103 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * scheduler_error_mailer +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: scheduler_error_mailer +#: model:mail.template,body_html:scheduler_error_mailer.scheduler_error_mailer +msgid "\n" +" \n" +"
\n" +"\n" +"

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

\n" +"\n" +"\n" +"${ctx.get('job_exception') and ctx.get('job_exception').value or 'Failed to get the error message from the context.'}\n" +"\n" +"\n" +"

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

\n" +"\n" +"

Properties of the scheduler ${object.name or ''} :

\n" +"
    \n" +"
  • Model : ${object.model or ''}
  • \n" +"
  • Method : ${object.function or ''}
  • \n" +"
  • Arguments : ${object.args or ''}
  • \n" +"
  • Interval : ${object.interval_number or '0'} ${object.interval_type or ''}
  • \n" +"
  • Number of calls : ${object.numbercall or '0'}
  • \n" +"
  • Repeat missed : ${object.doall}
  • \n" +"
  • User : ${object.user_id.name or ''}
  • \n" +"
\n" +"\n" +"

\n" +"--
\n" +"Automatic e-mail sent by Odoo. Do not reply.
\n" +"Database : ${ctx.get('dbname')}\n" +"

\n" +"
\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 +msgid "Email Template" +msgstr "" + +#. 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 "" + +#. 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 "" + +#. module: scheduler_error_mailer +#: code:addons/scheduler_error_mailer/models/ir_cron.py:55 +#, python-format +msgid "Task failure with UID = %d." +msgstr "" + +#. 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 "" + diff --git a/scheduler_error_mailer/i18n/sl.po b/scheduler_error_mailer/i18n/sl.po new file mode 100644 index 000000000..bd9994cda --- /dev/null +++ b/scheduler_error_mailer/i18n/sl.po @@ -0,0 +1,117 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * scheduler_error_mailer +# +# Translators: +# OCA Transbot , 2016 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-08-06 02:49+0000\n" +"PO-Revision-Date: 2016-08-06 02:49+0000\n" +"Last-Translator: OCA Transbot , 2016\n" +"Language-Team: Slovenian (https://www.transifex.com/oca/teams/23907/sl/)\n" +"Language: sl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n" +"%100==4 ? 2 : 3);\n" + +#. module: scheduler_error_mailer +#: model:mail.template,body_html:scheduler_error_mailer.scheduler_error_mailer +msgid "" +"\n" +" \n" +"
\n" +"\n" +"

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

\n" +"\n" +"\n" +"${ctx.get('job_exception') and ctx.get('job_exception').value or 'Failed to " +"get the error message from the context.'}\n" +"\n" +"\n" +"

You may check the logs of the Odoo server to get more information about " +"this failure.

\n" +"\n" +"

Properties of the scheduler ${object.name or ''} :

\n" +"
    \n" +"
  • Model : ${object.model or ''}
  • \n" +"
  • Method : ${object.function or ''}
  • \n" +"
  • Arguments : ${object.args or ''}
  • \n" +"
  • Interval : ${object.interval_number or '0'} ${object.interval_type or ''}" +"
  • \n" +"
  • Number of calls : ${object.numbercall or '0'}
  • \n" +"
  • Repeat missed : ${object.doall}
  • \n" +"
  • User : ${object.user_id.name or ''}
  • \n" +"
\n" +"\n" +"

\n" +"--
\n" +"Automatic e-mail sent by Odoo. Do not reply.
\n" +"Database : ${ctx.get('dbname')}\n" +"

\n" +"
\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 "Predloga obvestila o napaki" + +#. 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 "Predloga obvestila o napaki" + +#. 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 "Izberite predlogo za razpošiljanje ob napakah razporejevalca." + +#. module: scheduler_error_mailer +#: code:addons/scheduler_error_mailer/models/ir_cron.py:55 +#, python-format +msgid "Task failure with UID = %d." +msgstr "Napaka pri opravilu 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')}] Razporejevalec '${object.name or ''}' NEUSPEŠEN" diff --git a/scheduler_error_mailer/i18n/zh_CN.po b/scheduler_error_mailer/i18n/zh_CN.po new file mode 100644 index 000000000..4a074219c --- /dev/null +++ b/scheduler_error_mailer/i18n/zh_CN.po @@ -0,0 +1,116 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * scheduler_error_mailer +# +# Translators: +# Jeffery Chenn , 2016 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-08-31 11:58+0000\n" +"PO-Revision-Date: 2016-08-31 11:58+0000\n" +"Last-Translator: Jeffery Chenn , 2016\n" +"Language-Team: Chinese (China) (https://www.transifex.com/oca/teams/23907/" +"zh_CN/)\n" +"Language: zh_CN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#. module: scheduler_error_mailer +#: model:mail.template,body_html:scheduler_error_mailer.scheduler_error_mailer +msgid "" +"\n" +" \n" +"
\n" +"\n" +"

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

\n" +"\n" +"\n" +"${ctx.get('job_exception') and ctx.get('job_exception').value or 'Failed to " +"get the error message from the context.'}\n" +"\n" +"\n" +"

You may check the logs of the Odoo server to get more information about " +"this failure.

\n" +"\n" +"

Properties of the scheduler ${object.name or ''} :

\n" +"
    \n" +"
  • Model : ${object.model or ''}
  • \n" +"
  • Method : ${object.function or ''}
  • \n" +"
  • Arguments : ${object.args or ''}
  • \n" +"
  • Interval : ${object.interval_number or '0'} ${object.interval_type or ''}" +"
  • \n" +"
  • Number of calls : ${object.numbercall or '0'}
  • \n" +"
  • Repeat missed : ${object.doall}
  • \n" +"
  • User : ${object.user_id.name or ''}
  • \n" +"
\n" +"\n" +"

\n" +"--
\n" +"Automatic e-mail sent by Odoo. Do not reply.
\n" +"Database : ${ctx.get('dbname')}\n" +"

\n" +"
\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 "错误E-mail 模板" + +#. 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 "错误E-mail 模板" + +#. 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 "" + +#. module: scheduler_error_mailer +#: code:addons/scheduler_error_mailer/models/ir_cron.py:55 +#, python-format +msgid "Task failure with UID = %d." +msgstr "" + +#. 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 "" diff --git a/scheduler_error_mailer/images/scheduler_error_mailer.jpg b/scheduler_error_mailer/images/scheduler_error_mailer.jpg new file mode 100644 index 000000000..a8a3af766 Binary files /dev/null and b/scheduler_error_mailer/images/scheduler_error_mailer.jpg differ diff --git a/scheduler_error_mailer/models/__init__.py b/scheduler_error_mailer/models/__init__.py new file mode 100644 index 000000000..b365c0e97 --- /dev/null +++ b/scheduler_error_mailer/models/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import ir_cron diff --git a/scheduler_error_mailer/models/ir_cron.py b/scheduler_error_mailer/models/ir_cron.py new file mode 100644 index 000000000..2bce89dd4 --- /dev/null +++ b/scheduler_error_mailer/models/ir_cron.py @@ -0,0 +1,55 @@ +# Copyright 2012-2013 Akretion Sébastien BEAU,David Beal,Alexis de Lattre +# Copyright 2016 Sodexis +# Copyright 2018 bloopark systems () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import _, api, fields, models +from odoo.exceptions import UserError +import logging + + +_logger = logging.getLogger(__name__) + + +class IrCron(models.Model): + _inherit = "ir.cron" + + email_template_id = fields.Many2one( + comodel_name="mail.template", + string="Error E-mail Template", + help="Select the email template that will be sent when " + "this scheduler fails." + ) + + @api.model + def _handle_callback_exception(self, cron_name, server_action_id, job_id, + job_exception): + res = super(IrCron, self)._handle_callback_exception(cron_name, + server_action_id, + job_id, + job_exception) + my_cron = self.browse(job_id) + + if my_cron.email_template_id: + # we put the job_exception in context to be able to print it inside + # the email template + context = { + 'job_exception': job_exception, + 'dbname': self._cr.dbname, + } + + _logger.debug( + "Sending scheduler error email with context=%s", context) + + self.env['mail.template'].browse( + my_cron.email_template_id.id + ).with_context(context).sudo().send_mail( + my_cron.id, force_send=True) + + return res + + @api.model + def _test_scheduler_failure(self): + """This function is used to test and debug this module.""" + raise UserError( + _("Task failure with UID = %d.") % self._uid) diff --git a/scheduler_error_mailer/readme/CONFIGURE.rst b/scheduler_error_mailer/readme/CONFIGURE.rst new file mode 100644 index 000000000..baf4c1a6d --- /dev/null +++ b/scheduler_error_mailer/readme/CONFIGURE.rst @@ -0,0 +1,4 @@ +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. diff --git a/scheduler_error_mailer/readme/CONTRIBUTORS.rst b/scheduler_error_mailer/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..496cedb9f --- /dev/null +++ b/scheduler_error_mailer/readme/CONTRIBUTORS.rst @@ -0,0 +1,9 @@ +* Sébastien BEAU +* David Beal +* Alexis de Lattre +* Sodexis +* Achraf Mhadhbi + +* `Tecnativa `_: + + * Cristina Martin R. diff --git a/scheduler_error_mailer/readme/DESCRIPTION.rst b/scheduler_error_mailer/readme/DESCRIPTION.rst new file mode 100644 index 000000000..6e097d81f --- /dev/null +++ b/scheduler_error_mailer/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This module adds the possibility to send an e-mail when a scheduler raises +an error. diff --git a/scheduler_error_mailer/static/description/icon.png b/scheduler_error_mailer/static/description/icon.png new file mode 100644 index 000000000..6b22abf97 Binary files /dev/null and b/scheduler_error_mailer/static/description/icon.png differ diff --git a/scheduler_error_mailer/views/ir_cron.xml b/scheduler_error_mailer/views/ir_cron.xml new file mode 100644 index 000000000..a6ee1f9da --- /dev/null +++ b/scheduler_error_mailer/views/ir_cron.xml @@ -0,0 +1,23 @@ + + + + + + + ir.cron.error.mailer.form + ir.cron + + + + + + + + +