diff --git a/__unported__/scheduler_error_mailer/i18n/scheduler_error_mailer.pot b/__unported__/scheduler_error_mailer/i18n/scheduler_error_mailer.pot deleted file mode 100644 index c83ab22af..000000000 --- a/__unported__/scheduler_error_mailer/i18n/scheduler_error_mailer.pot +++ /dev/null @@ -1,16 +0,0 @@ -# Translation of OpenERP Server. -# This file contains the translation of the following modules: -# -msgid "" -msgstr "" -"Project-Id-Version: OpenERP Server 7.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-03-14 17:41+0000\n" -"PO-Revision-Date: 2014-03-14 17:41+0000\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" - diff --git a/__unported__/scheduler_error_mailer/__init__.py b/scheduler_error_mailer/__init__.py similarity index 100% rename from __unported__/scheduler_error_mailer/__init__.py rename to scheduler_error_mailer/__init__.py diff --git a/__unported__/scheduler_error_mailer/__openerp__.py b/scheduler_error_mailer/__openerp__.py similarity index 96% rename from __unported__/scheduler_error_mailer/__openerp__.py rename to scheduler_error_mailer/__openerp__.py index d1cf8fd95..a34e58b34 100644 --- a/__unported__/scheduler_error_mailer/__openerp__.py +++ b/scheduler_error_mailer/__openerp__.py @@ -33,7 +33,8 @@ Scheduler Error Mailer ====================== -This module adds the possibility to send an e-mail when a scheduler raises an error.""", +This module adds the possibility to send an e-mail when a scheduler raises +an error.""", 'author': 'Akretion', 'website': 'http://www.akretion.com/', 'depends': ['email_template'], @@ -43,6 +44,5 @@ This module adds the possibility to send an e-mail when a scheduler raises an er ], 'demo': ['ir_cron_demo.xml'], 'images': ['images/scheduler_error_mailer.jpg'], - 'installable': False, - 'active': False, + 'installable': True, } 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..95fe5ca84 --- /dev/null +++ b/scheduler_error_mailer/i18n/scheduler_error_mailer.pot @@ -0,0 +1,76 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * scheduler_error_mailer +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0rc1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-09-18 11:55+0000\n" +"PO-Revision-Date: 2014-09-18 11:55+0000\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:email.template,body_html:scheduler_error_mailer.scheduler_error_mailer +msgid "\n" +"
\n" +"\n" +"

OpenERP 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 OpenERP server to get more information about this failure.

\n" +"\n" +"

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

\n" +"\n" +"\n" +"

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

\n" +"
\n" +" " +msgstr "" + +#. module: scheduler_error_mailer +#: code:addons/scheduler_error_mailer/ir_cron.py:74 +#, python-format +msgid "Error :" +msgstr "" + +#. module: scheduler_error_mailer +#: field:ir.cron,email_template:0 +msgid "Error E-mail Template" +msgstr "" + +#. module: scheduler_error_mailer +#: help:ir.cron,email_template:0 +msgid "Select the email template that will be sent when this scheduler fails." +msgstr "" + +#. module: scheduler_error_mailer +#: code:addons/scheduler_error_mailer/ir_cron.py:75 +#, python-format +msgid "Task failure with UID = %d." +msgstr "" + +#. module: scheduler_error_mailer +#: model:email.template,subject:scheduler_error_mailer.scheduler_error_mailer +msgid "[DB ${ctx.get('dbname')}] Scheduler '${object.name or ''}' FAILED" +msgstr "" diff --git a/__unported__/scheduler_error_mailer/images/scheduler_error_mailer.jpg b/scheduler_error_mailer/images/scheduler_error_mailer.jpg similarity index 100% rename from __unported__/scheduler_error_mailer/images/scheduler_error_mailer.jpg rename to scheduler_error_mailer/images/scheduler_error_mailer.jpg diff --git a/__unported__/scheduler_error_mailer/ir_cron.py b/scheduler_error_mailer/ir_cron.py similarity index 77% rename from __unported__/scheduler_error_mailer/ir_cron.py rename to scheduler_error_mailer/ir_cron.py index 8971da486..17b0f2c30 100644 --- a/__unported__/scheduler_error_mailer/ir_cron.py +++ b/scheduler_error_mailer/ir_cron.py @@ -22,11 +22,13 @@ # ############################################################################## +from openerp import SUPERUSER_ID from openerp.osv import orm, fields from openerp.tools.translate import _ import logging -logger = logging.getLogger(__name__) + +_logger = logging.getLogger(__name__) class ir_cron(orm.Model): @@ -36,10 +38,12 @@ class ir_cron(orm.Model): 'email_template': fields.many2one( 'email.template', 'Error E-mail Template', - help="Select the email template that will be sent when this scheduler fails."), + help="Select the email template that will be " + "sent when this scheduler fails."), } - def _handle_callback_exception(self, cr, uid, model_name, method_name, args, job_id, job_exception): + def _handle_callback_exception(self, cr, uid, model_name, method_name, + args, job_id, job_exception): res = super(ir_cron, self)._handle_callback_exception( cr, uid, model_name, method_name, args, job_id, job_exception) @@ -52,19 +56,20 @@ class ir_cron(orm.Model): context = { 'job_exception': job_exception, 'dbname': cr.dbname, - } + } + + _logger.debug("Sending scheduler error email with context=%s", + context) - logger.debug("Sending scheduler error email with context=%s" % context) self.pool['email.template'].send_mail( - cr, uid, my_cron.email_template.id, my_cron.id, + cr, SUPERUSER_ID, my_cron.email_template.id, my_cron.id, force_send=True, context=context) return res - -class res_users(orm.Model): - _inherit = 'res.users' - - def test_scheduler_failure(self, cr, uid, context=None): + def _test_scheduler_failure(self, cr, uid, context=None): """This function is used to test and debug this module""" - raise orm.except_orm(_('Error :'), _("Task failure with UID = %d." % uid)) + + raise orm.except_orm( + _('Error :'), + _("Task failure with UID = %d.") % uid) diff --git a/__unported__/scheduler_error_mailer/ir_cron.xml b/scheduler_error_mailer/ir_cron.xml similarity index 100% rename from __unported__/scheduler_error_mailer/ir_cron.xml rename to scheduler_error_mailer/ir_cron.xml diff --git a/__unported__/scheduler_error_mailer/ir_cron_demo.xml b/scheduler_error_mailer/ir_cron_demo.xml similarity index 83% rename from __unported__/scheduler_error_mailer/ir_cron_demo.xml rename to scheduler_error_mailer/ir_cron_demo.xml index d8453b4bf..4c6fc5e7b 100644 --- a/__unported__/scheduler_error_mailer/ir_cron_demo.xml +++ b/scheduler_error_mailer/ir_cron_demo.xml @@ -18,9 +18,8 @@ -1 - - - + ir.cron + _test_scheduler_failure diff --git a/__unported__/scheduler_error_mailer/ir_cron_email_tpl.xml b/scheduler_error_mailer/ir_cron_email_tpl.xml similarity index 100% rename from __unported__/scheduler_error_mailer/ir_cron_email_tpl.xml rename to scheduler_error_mailer/ir_cron_email_tpl.xml diff --git a/__unported__/scheduler_error_mailer/static/src/img/icon.png b/scheduler_error_mailer/static/description/icon.png similarity index 100% rename from __unported__/scheduler_error_mailer/static/src/img/icon.png rename to scheduler_error_mailer/static/description/icon.png