commit
82319f78a3
|
@ -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"
|
||||
|
|
@ -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,
|
||||
}
|
|
@ -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"
|
||||
"<div style=\"font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; \">\n"
|
||||
"\n"
|
||||
"<p>OpenERP 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 OpenERP 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 OpenERP. Do not reply.<br/>\n"
|
||||
"Database : ${ctx.get('dbname')}\n"
|
||||
"</p>\n"
|
||||
"</div>\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 ""
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
|
@ -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)
|
||||
|
@ -54,17 +58,18 @@ class ir_cron(orm.Model):
|
|||
'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)
|
|
@ -18,9 +18,8 @@
|
|||
<field name="numbercall">-1</field> <!-- don't limit the number of calls -->
|
||||
<field name="doall" eval="True"/>
|
||||
<field name="email_template" ref="scheduler_error_mailer"/>
|
||||
<field name="model" eval="'res.users'"/>
|
||||
<field name="function" eval="'test_scheduler_failure'" />
|
||||
<field name="args" eval="'()'"/>
|
||||
<field name="model">ir.cron</field>
|
||||
<field name="function">_test_scheduler_failure</field>
|
||||
</record>
|
||||
|
||||
</data>
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
Loading…
Reference in New Issue