|
|
@ -27,16 +27,16 @@ class ir_cron(osv.osv, netsvc.Agent): |
|
|
|
_inherit = "ir.cron" |
|
|
|
|
|
|
|
_columns = { |
|
|
|
'email_TO' : fields.char('TO', size=256, help="If an error occure with this scheduler an email will be send"), |
|
|
|
'email_to' : fields.char('TO', size=256, help="If an error occure with this scheduler an email will be send"), |
|
|
|
'message' : fields.text('Message', help="If an error occure with this scheduler this message will be send via email"), |
|
|
|
'send_email?' : fields.boolean('Active'), |
|
|
|
'send_email' : fields.boolean('Active'), |
|
|
|
'email_account' : fields.many2one('poweremail.core_accounts', 'FROM') |
|
|
|
} |
|
|
|
|
|
|
|
def _callback(self, cr, uid, model, func, args, job_id): |
|
|
|
res = super(ir_cron, self)._callback(cr, uid, model, func, args, job_id) |
|
|
|
if not res: |
|
|
|
def _handle_callback_exception(self, cr, uid, model, func, args, job_id, job_exception): |
|
|
|
super(ir_cron, self)._handle_callback_exception(cr, uid, model, func, args, job_id, job_exception) |
|
|
|
job = self.read(cr, uid, job_id, ['send_email?', 'message', 'email_TO', 'email_account', 'name']) |
|
|
|
#TODO USE POWEREMAIL TEMPLATE |
|
|
|
if job['send_email?']: |
|
|
|
addresses = {'To' : job['email_TO']} |
|
|
|
mail_obj = self.pool.get('poweremail.mailbox') |
|
|
|