|
@ -26,7 +26,8 @@ from openerp.osv import orm, fields |
|
|
from openerp.tools.translate import _ |
|
|
from openerp.tools.translate import _ |
|
|
import logging |
|
|
import logging |
|
|
|
|
|
|
|
|
logger = logging.getLogger(__name__) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_logger = logging.getLogger(__name__) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ir_cron(orm.Model): |
|
|
class ir_cron(orm.Model): |
|
@ -36,10 +37,12 @@ class ir_cron(orm.Model): |
|
|
'email_template': fields.many2one( |
|
|
'email_template': fields.many2one( |
|
|
'email.template', |
|
|
'email.template', |
|
|
'Error E-mail 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( |
|
|
res = super(ir_cron, self)._handle_callback_exception( |
|
|
cr, uid, model_name, method_name, args, job_id, job_exception) |
|
|
cr, uid, model_name, method_name, args, job_id, job_exception) |
|
@ -52,9 +55,11 @@ class ir_cron(orm.Model): |
|
|
context = { |
|
|
context = { |
|
|
'job_exception': job_exception, |
|
|
'job_exception': job_exception, |
|
|
'dbname': cr.dbname, |
|
|
'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( |
|
|
self.pool['email.template'].send_mail( |
|
|
cr, uid, my_cron.email_template.id, my_cron.id, |
|
|
cr, uid, my_cron.email_template.id, my_cron.id, |
|
|
force_send=True, context=context) |
|
|
force_send=True, context=context) |
|
|