Browse Source
Port to OpenERP 7.0.
Port to OpenERP 7.0.
Add logo and screenshot. Add demo scheduler and test/debug function.pull/1524/head
Alexis de Lattre
11 years ago
committed by
Cristina Martin
9 changed files with 140 additions and 107 deletions
-
9scheduler_error_mailer/__init__.py
-
23scheduler_error_mailer/__openerp__.py
-
BINscheduler_error_mailer/images/scheduler_error_mailer.jpg
-
47scheduler_error_mailer/ir_cron.py
-
14scheduler_error_mailer/ir_cron.xml
-
27scheduler_error_mailer/ir_cron_demo.xml
-
40scheduler_error_mailer/ir_cron_email_tpl.xml
-
BINscheduler_error_mailer/static/src/img/icon.png
-
39scheduler_error_mailer/test_fail_scheduler.py
After Width: 900 | Height: 364 | Size: 29 KiB |
@ -1,24 +1,24 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- |
|||
Copyright (C) 2012 Akretion |
|||
Copyright (C) 2012-2013 Akretion (http://www.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="email_template" colspan="2"/> |
|||
</group> |
|||
<field name="doall" position="after"> |
|||
<field name="email_template" /> |
|||
</field> |
|||
</field> |
|||
</record> |
|||
|
|||
|
|||
</data> |
|||
</openerp> |
@ -0,0 +1,27 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
|
|||
<!-- |
|||
Copyright (C) 2013 Akretion (http://www.akretion.com/) |
|||
@author Alexis de Lattre <alexis.delattre@akretion.com> |
|||
The licence is in the file __openerp__.py |
|||
--> |
|||
|
|||
<openerp> |
|||
<data noupdate="1"> |
|||
|
|||
<record id="test_scheduler_error_mailer" model="ir.cron"> |
|||
<field name="name">Test Scheduler Error Mailer</field> |
|||
<field name="active" eval="False"/> |
|||
<field name="user_id" ref="base.user_root"/> |
|||
<field name="interval_number">1</field> |
|||
<field name="interval_type">hours</field> |
|||
<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="'()'"/> |
|||
</record> |
|||
|
|||
</data> |
|||
</openerp> |
@ -1,32 +1,50 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- |
|||
Copyright (C) 2012 Akretion |
|||
Copyright (C) 2012-2013 Akretion (http://www.akretion.com/) |
|||
The licence is in the file __openerp__.py |
|||
--> |
|||
|
|||
<openerp> |
|||
<!-- Email template --> |
|||
<data noupdate="1"> |
|||
|
|||
<!-- Error Email template --> |
|||
<record id="scheduler_error_mailer" model="email.template"> |
|||
<field name="name">Scheduler error</field> |
|||
<field name="name">Scheduler Error</field> |
|||
<field name="email_from">${object.user_id.user_email or ''}</field> |
|||
<field name="subject">[DB ${object._cr.dbname}] Scheduler '${object.name or ''}' FAILED</field> |
|||
<field name="email_to">${object.user_id.user_email or ''}</field> |
|||
<field name="subject">[DB ${ctx.get('dbname')}] Scheduler '${object.name or ''}' FAILED</field> |
|||
<field name="model_id" ref="base.model_ir_cron"/> |
|||
<field name="auto_delete" eval="True"/> |
|||
<field name="body_text"><![CDATA[ |
|||
On the database '${object._cr.dbname}', OpenERP has run the scheduler '${object.name or ''}' but it failed. Here is the error message : |
|||
<field name="body_html"><![CDATA[ |
|||
<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; "> |
|||
|
|||
${hasattr(context.get('ctx').get('job_exception'), 'value') and context.get('ctx').get('job_exception').value or context.get('ctx').get('job_exception')} |
|||
<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> |
|||
|
|||
You may check the logs of OpenERP to get more information about this failure. |
|||
<strong> |
|||
${ctx.get('job_exception') and ctx.get('job_exception').value or 'Failed to get the error message from the context.'} |
|||
</strong> |
|||
|
|||
The next action on this task is scheduled on ${object.nextcall or ''}. |
|||
<p>You may check the logs of the OpenERP server to get more information about this failure.</p> |
|||
|
|||
-- |
|||
Automatic e-mail sent by OpenERP. Do not reply. |
|||
<p>Properties of the scheduler <em>${object.name or ''}</em> :</p> |
|||
<ul> |
|||
<li>Model : ${object.model or ''}</li> |
|||
<li>Method : ${object.function or ''}</li> |
|||
<li>Arguments : ${object.args or ''}</li> |
|||
<li>Interval : ${object.interval_number or '0'} ${object.interval_type or ''}</li> |
|||
<li>Number of calls : ${object.numbercall or '0'}</li> |
|||
<li>Repeat missed : ${object.doall}</li> |
|||
<li>User : ${object.user_id.name or ''}</li> |
|||
</ul> |
|||
|
|||
<p> |
|||
-- <br/> |
|||
Automatic e-mail sent by OpenERP. Do not reply.<br/> |
|||
Database : ${ctx.get('dbname')} |
|||
</p> |
|||
</div> |
|||
]]></field> |
|||
</record> |
|||
|
|||
</data> |
|||
</openerp> |
After Width: 64 | Height: 64 | Size: 4.9 KiB |
@ -1,39 +0,0 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Scheduler error mailer module for OpenERP |
|||
# Copyright (C) 2012 Akretion |
|||
# @author David Beal <bealdavid@gmail.com> |
|||
# @author Alexis de Lattre <alexis.delattre@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/>. |
|||
# |
|||
############################################################################## |
|||
|
|||
from osv import fields, osv |
|||
from tools.translate import _ |
|||
|
|||
class test_fail_scheduler(osv.osv_memory): |
|||
_name = "test.fail.scheduler" |
|||
_description = "Test scheduler failure" |
|||
|
|||
def test_fail(self, cr, uid, context=None): |
|||
""" This a test fail, only for debugging purpose |
|||
DO NOT UNCOMMENT IMPORT IN init.py IN PRODUCTION ENVIRONNEMENT |
|||
""" |
|||
|
|||
raise osv.except_osv(_('Error :'), _("task failure")) |
|||
# context['tytytyty'] |
|||
|
|||
test_fail_scheduler() |
Write
Preview
Loading…
Cancel
Save
Reference in new issue