Browse Source

[IMP] improve and port to V6

pull/2/head
sebastien beau 14 years ago
parent
commit
6bbab3d9b5
  1. 2
      scheduler_error_mailer/__openerp__.py
  2. 10
      scheduler_error_mailer/ir_cron.py
  3. 6
      scheduler_error_mailer/ir_cron.xml

2
scheduler_error_mailer/__terp__.py → scheduler_error_mailer/__openerp__.py

@ -25,7 +25,7 @@
'version': '0.1', 'version': '0.1',
'category': 'Generic Modules/Others', 'category': 'Generic Modules/Others',
'license': 'AGPL-3', 'license': 'AGPL-3',
'description': """This module add the posibility to send a email when a scheduler raise an error""",
'description': """This module dfkdsjfkdsjkfjksadd the posibility to send a email when a scheduler raise an error""",
'author': 'Akretion', 'author': 'Akretion',
'website': 'http://www.akretion.com/', 'website': 'http://www.akretion.com/',
'depends': ['poweremail'], 'depends': ['poweremail'],

10
scheduler_error_mailer/ir_cron.py

@ -27,16 +27,16 @@ class ir_cron(osv.osv, netsvc.Agent):
_inherit = "ir.cron" _inherit = "ir.cron"
_columns = { _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"), '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') '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']) job = self.read(cr, uid, job_id, ['send_email?', 'message', 'email_TO', 'email_account', 'name'])
#TODO USE POWEREMAIL TEMPLATE
if job['send_email?']: if job['send_email?']:
addresses = {'To' : job['email_TO']} addresses = {'To' : job['email_TO']}
mail_obj = self.pool.get('poweremail.mailbox') mail_obj = self.pool.get('poweremail.mailbox')

6
scheduler_error_mailer/ir_cron.xml

@ -2,7 +2,7 @@
<!-- <!--
model module for OpenERP model module for OpenERP
Copyright (C) 2010 Sébastien BEAU <sebastien.beau@akretion.com> Copyright (C) 2010 Sébastien BEAU <sebastien.beau@akretion.com>
The licence is in the file __terp__.py
The licence is in the file __openerp__.py
--> -->
<openerp> <openerp>
@ -16,9 +16,9 @@
<field name="doall" position='after'> <field name="doall" position='after'>
<group col="6" colspan="4"> <group col="6" colspan="4">
<separator string="Error Mailer" colspan="6"/> <separator string="Error Mailer" colspan="6"/>
<field name="send_email?" colspan="1"/>
<field name="send_email" colspan="1"/>
<field name="email_account" colspan="1"/> <field name="email_account" colspan="1"/>
<field name="email_TO" colspan="1"/>
<field name="email_to" colspan="1"/>
<field name="message" nolabel='1' colspan="6"/> <field name="message" nolabel='1' colspan="6"/>
</group> </group>
</field> </field>

Loading…
Cancel
Save