[INIT] intial import
parent
58970dbaff
commit
5f27c49e03
|
@ -0,0 +1,23 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Asterisk Click2Dial module for OpenERP
|
||||||
|
# Copyright (C) 2010 Sébastien BEAU <sebastien.beau@akretion.com>
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as
|
||||||
|
# published by the Free Software Foundation, either version 3 of the
|
||||||
|
# License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
import ir_cron
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Model module for OpenERP
|
||||||
|
# Copyright (C) 2010 Sébastien BEAU <sebastien.beau@akretion.com>
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as
|
||||||
|
# published by the Free Software Foundation, either version 3 of the
|
||||||
|
# License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
'name': 'Scheduler Error Mailer',
|
||||||
|
'version': '0.1',
|
||||||
|
'category': 'Generic Modules/Others',
|
||||||
|
'license': 'AGPL-3',
|
||||||
|
'description': """This module dfkdsjfkdsjkfjksadd the posibility to send a email when a scheduler raise an error""",
|
||||||
|
'author': 'Akretion',
|
||||||
|
'website': 'http://www.akretion.com/',
|
||||||
|
'depends': ['poweremail'],
|
||||||
|
'init_xml': [],
|
||||||
|
'update_xml': ['ir_cron.xml'],
|
||||||
|
'demo_xml': [],
|
||||||
|
'installable': True,
|
||||||
|
'active': False,
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
#################################################################################
|
||||||
|
# #
|
||||||
|
# Model module for OpenERP #
|
||||||
|
# Copyright (C) 2010 Sébastien BEAU <sebastien.beau@akretion.comr> #
|
||||||
|
# #
|
||||||
|
# This program is free software: you can redistribute it and/or modify #
|
||||||
|
# it under the terms of the GNU Affero General Public License as #
|
||||||
|
# published by the Free Software Foundation, either version 3 of the #
|
||||||
|
# License, or (at your option) any later version. #
|
||||||
|
# #
|
||||||
|
# This program is distributed in the hope that it will be useful, #
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
||||||
|
# GNU Affero General Public License for more details. #
|
||||||
|
# #
|
||||||
|
# You should have received a copy of the GNU Affero General Public License #
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
|
||||||
|
# #
|
||||||
|
#################################################################################
|
||||||
|
|
||||||
|
from osv import osv, fields
|
||||||
|
import netsvc
|
||||||
|
|
||||||
|
|
||||||
|
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"),
|
||||||
|
'message' : fields.text('Message', help="If an error occure with this scheduler this message will be send via email"),
|
||||||
|
'send_email' : fields.boolean('Active'),
|
||||||
|
'email_account' : fields.many2one('poweremail.core_accounts', 'FROM')
|
||||||
|
}
|
||||||
|
|
||||||
|
def _handle_callback_exception(self, cr, uid, model, func, args, job_id, job_exception):
|
||||||
|
res = 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')
|
||||||
|
id = mail_obj.create(cr, uid, {
|
||||||
|
'pem_to' : job['email_TO'],
|
||||||
|
'pem_subject' : "OPENERP : error when excecuting scheduler " + job["name"],
|
||||||
|
'pem_body_text' : job['message'],
|
||||||
|
'pem_account_id' : job['email_account'][0],
|
||||||
|
'mail_type' : 'text/plain',
|
||||||
|
'folder' : 'outbox',
|
||||||
|
'state' :'na',
|
||||||
|
})
|
||||||
|
mail_obj.send_this_mail(cr, uid, [id])
|
||||||
|
return res
|
||||||
|
ir_cron()
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
model module for OpenERP
|
||||||
|
Copyright (C) 2010 Sébastien BEAU <sebastien.beau@akretion.com>
|
||||||
|
The licence is in the file __openerp__.py
|
||||||
|
-->
|
||||||
|
|
||||||
|
<openerp>
|
||||||
|
<data>
|
||||||
|
<record id="ir_cron_error_mailer_view" model="ir.ui.view">
|
||||||
|
<field name="name">ir.cron.error.mailer.form</field>
|
||||||
|
<field name="model">ir.cron</field>
|
||||||
|
<field name="inherit_id" ref="base.ir_cron_view"/>
|
||||||
|
<field name="type">form</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<field name="doall" position='after'>
|
||||||
|
<group col="6" colspan="4">
|
||||||
|
<separator string="Error Mailer" colspan="6"/>
|
||||||
|
<field name="send_email" colspan="1"/>
|
||||||
|
<field name="email_account" colspan="1"/>
|
||||||
|
<field name="email_to" colspan="1"/>
|
||||||
|
<field name="message" nolabel='1' colspan="6"/>
|
||||||
|
</group>
|
||||||
|
</field>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
</data>
|
||||||
|
</openerp>
|
Loading…
Reference in New Issue