17 changed files with 498 additions and 0 deletions
			
			
		@ -0,0 +1,31 @@ | 
				
			|||||
 | 
					Cron Job Failure Notifications v9 | 
				
			||||
 | 
					================================= | 
				
			||||
 | 
					This module will generate error Logs for Scheduled Actions / Cron jobs running in backend server. | 
				
			||||
 | 
					Purpose of module to have creating history & PDF reports of failure of all jobs in backend. | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Features | 
				
			||||
 | 
					======== | 
				
			||||
 | 
					* Any failure will automatically logged. | 
				
			||||
 | 
					* PDF Report for error logs. | 
				
			||||
 | 
					* Custom Error Logs Scheduled Actions Email Template. | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Installation | 
				
			||||
 | 
					============ | 
				
			||||
 | 
					No other requirements. | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					To test the module: | 
				
			||||
 | 
					- Activate Developer mode | 
				
			||||
 | 
					- Go to Settings --> Technical --> Automation --> Scheduled actions. | 
				
			||||
 | 
					- Select the record "Test Cron Failure Notification" and check active button. | 
				
			||||
 | 
					- Click the button 'Run Manually'. | 
				
			||||
 | 
					- A log of scheduler failure will be created under the menu 'Logs Scheduled Actions'. | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Configuration | 
				
			||||
 | 
					============= | 
				
			||||
 | 
					To analyse/test the log history of cron failure, | 
				
			||||
 | 
					Go to Settings --> Technical --> Automation --> Logs Scheduled Actions. | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Credits | 
				
			||||
 | 
					======= | 
				
			||||
 | 
					Developer: Mufeeda C K @ cybrosys | 
				
			||||
 | 
					Guidance: Nilmar Shereef @ cybrosys, shereef@cybrosys.in | 
				
			||||
@ -0,0 +1,23 @@ | 
				
			|||||
 | 
					# -*- coding: utf-8 -*- | 
				
			||||
 | 
					############################################################################## | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Cybrosys Technologies Pvt. Ltd. | 
				
			||||
 | 
					#    Copyright (C) 2009-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). | 
				
			||||
 | 
					#    Author: Nilmar Shereef(<http://www.cybrosys.com>) | 
				
			||||
 | 
					#    you can modify it under the terms of the GNU LESSER | 
				
			||||
 | 
					#    GENERAL PUBLIC LICENSE (LGPL v3), Version 3. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    It is forbidden to publish, distribute, sublicense, or sell copies | 
				
			||||
 | 
					#    of the Software or modified copies of the Software. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE | 
				
			||||
 | 
					#    GENERAL PUBLIC LICENSE (LGPL v3) along with this program. | 
				
			||||
 | 
					#    If not, see <http://www.gnu.org/licenses/>. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					############################################################################## | 
				
			||||
 | 
					import models | 
				
			||||
@ -0,0 +1,48 @@ | 
				
			|||||
 | 
					# -*- coding: utf-8 -*- | 
				
			||||
 | 
					############################################################################## | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Cybrosys Technologies Pvt. Ltd. | 
				
			||||
 | 
					#    Copyright (C) 2009-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). | 
				
			||||
 | 
					#    Author: Nilmar Shereef(<http://www.cybrosys.com>) | 
				
			||||
 | 
					#    you can modify it under the terms of the GNU LESSER | 
				
			||||
 | 
					#    GENERAL PUBLIC LICENSE (LGPL v3), Version 3. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    It is forbidden to publish, distribute, sublicense, or sell copies | 
				
			||||
 | 
					#    of the Software or modified copies of the Software. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE | 
				
			||||
 | 
					#    GENERAL PUBLIC LICENSE (LGPL v3) along with this program. | 
				
			||||
 | 
					#    If not, see <http://www.gnu.org/licenses/>. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					############################################################################## | 
				
			||||
 | 
					{ | 
				
			||||
 | 
					    'name': "Cron Job Failure Notification", | 
				
			||||
 | 
					    'summary': """Cron jobs/Scheduled Actions failure Log Notification & Its PDF Reports""", | 
				
			||||
 | 
					    'description': """ | 
				
			||||
 | 
					        This module will generate error Logs for Scheduled | 
				
			||||
 | 
					        Actions / Cron jobs running in backend server | 
				
			||||
 | 
					    """, | 
				
			||||
 | 
					    'author': "Cybrosys Techno Solution", | 
				
			||||
 | 
					    'website': "http://www.cybrosys.com", | 
				
			||||
 | 
					    'category': 'Extra Tools', | 
				
			||||
 | 
					    'depends': ['base', 'mail', 'web', 'base_setup'], | 
				
			||||
 | 
					    'data': [ | 
				
			||||
 | 
					        'views/logs_scheduled_actions_view.xml', | 
				
			||||
 | 
					        'views/error_log_report_template.xml', | 
				
			||||
 | 
					        'views/report.xml', | 
				
			||||
 | 
					        'views/error_mail_template.xml', | 
				
			||||
 | 
					    ], | 
				
			||||
 | 
					    'demo': [ | 
				
			||||
 | 
					        'demo/ir_cron_demo.xml', | 
				
			||||
 | 
					    ], | 
				
			||||
 | 
					    'images': ['static/description/banner.jpg'], | 
				
			||||
 | 
					    'license': 'AGPL-3', | 
				
			||||
 | 
					    'installable': True, | 
				
			||||
 | 
					    'auto_install': False, | 
				
			||||
 | 
					    'application': False, | 
				
			||||
 | 
					} | 
				
			||||
@ -0,0 +1,19 @@ | 
				
			|||||
 | 
					<?xml version="1.0" encoding="utf-8"?> | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					<openerp> | 
				
			||||
 | 
					    <data noupdate="1"> | 
				
			||||
 | 
					        <record id="test_scheduler_error_mailer" model="ir.cron"> | 
				
			||||
 | 
					            <field name="name">Test Cron Failure Notification</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="model">ir.cron</field> | 
				
			||||
 | 
					            <field name="function">_test_scheduler_failure</field> | 
				
			||||
 | 
					            <field name="email_template_id" ref="cron_failure_notification.scheduler_error_mailer"/> | 
				
			||||
 | 
					        </record> | 
				
			||||
 | 
					    </data> | 
				
			||||
 | 
					</openerp> | 
				
			||||
@ -0,0 +1,23 @@ | 
				
			|||||
 | 
					# -*- coding: utf-8 -*- | 
				
			||||
 | 
					############################################################################## | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Cybrosys Technologies Pvt. Ltd. | 
				
			||||
 | 
					#    Copyright (C) 2009-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). | 
				
			||||
 | 
					#    Author: Nilmar Shereef(<http://www.cybrosys.com>) | 
				
			||||
 | 
					#    you can modify it under the terms of the GNU LESSER | 
				
			||||
 | 
					#    GENERAL PUBLIC LICENSE (LGPL v3), Version 3. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    It is forbidden to publish, distribute, sublicense, or sell copies | 
				
			||||
 | 
					#    of the Software or modified copies of the Software. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE | 
				
			||||
 | 
					#    GENERAL PUBLIC LICENSE (LGPL v3) along with this program. | 
				
			||||
 | 
					#    If not, see <http://www.gnu.org/licenses/>. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					############################################################################## | 
				
			||||
 | 
					import logs_scheduled_actions | 
				
			||||
@ -0,0 +1,115 @@ | 
				
			|||||
 | 
					# -*- coding: utf-8 -*- | 
				
			||||
 | 
					############################################################################## | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Cybrosys Technologies Pvt. Ltd. | 
				
			||||
 | 
					#    Copyright (C) 2009-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). | 
				
			||||
 | 
					#    Author: Nilmar Shereef(<http://www.cybrosys.com>) | 
				
			||||
 | 
					#    you can modify it under the terms of the GNU LESSER | 
				
			||||
 | 
					#    GENERAL PUBLIC LICENSE (LGPL v3), Version 3. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    It is forbidden to publish, distribute, sublicense, or sell copies | 
				
			||||
 | 
					#    of the Software or modified copies of the Software. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE | 
				
			||||
 | 
					#    GENERAL PUBLIC LICENSE (LGPL v3) along with this program. | 
				
			||||
 | 
					#    If not, see <http://www.gnu.org/licenses/>. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					############################################################################## | 
				
			||||
 | 
					import datetime | 
				
			||||
 | 
					import logging | 
				
			||||
 | 
					from openerp import models, fields, api, _ | 
				
			||||
 | 
					from openerp.exceptions import UserError | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					class LogsScheduledActions(models.Model): | 
				
			||||
 | 
					    _description = "Error log" | 
				
			||||
 | 
					    _name = 'logs.action' | 
				
			||||
 | 
					    _inherit = ['mail.thread', 'ir.needaction_mixin', 'ir.cron'] | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    name = fields.Char(string="Name", required=True, track_visibility='always') | 
				
			||||
 | 
					    method = fields.Char(string="Method", track_visibility='always') | 
				
			||||
 | 
					    created_by = fields.Many2one('res.users', string="Created by", default=lambda self: self.env.user, index=True) | 
				
			||||
 | 
					    object_action = fields.Char(string="Object", track_visibility='always') | 
				
			||||
 | 
					    exec_date = fields.Datetime(string="Execution Date Time") | 
				
			||||
 | 
					    company_name = fields.Many2one('res.company', string="Company",  default=lambda self: self.env.user.company_id, | 
				
			||||
 | 
					                                   index=True) | 
				
			||||
 | 
					    stages_id = fields.Selection( | 
				
			||||
 | 
					        [('new', 'New'), ('confirm', 'Confirmed'), ('resolved', 'Resolved'), ('cancelled', 'Cancelled')], string="State", default='new') | 
				
			||||
 | 
					    error_details = fields.Char(string="Error details", track_visibility='always') | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @api.multi | 
				
			||||
 | 
					    def action_mail_send(self): | 
				
			||||
 | 
					        self.ensure_one() | 
				
			||||
 | 
					        ir_model_data = self.env['ir.model.data'] | 
				
			||||
 | 
					        template_id = ir_model_data.get_object_reference('cron_failure_notification', | 
				
			||||
 | 
					                                                         'scheduler_error_mailer')[1] | 
				
			||||
 | 
					        try: | 
				
			||||
 | 
					            compose_form_id = ir_model_data.get_object_reference('mail', 'email_compose_message_wizard_form')[1] | 
				
			||||
 | 
					        except ValueError: | 
				
			||||
 | 
					            compose_form_id = False | 
				
			||||
 | 
					        ctx = dict(self.env.context or {}) | 
				
			||||
 | 
					        ctx.update({ | 
				
			||||
 | 
					            'default_model': 'logs.action', | 
				
			||||
 | 
					            'default_res_id': self.ids[0], | 
				
			||||
 | 
					            'default_use_template': bool(template_id), | 
				
			||||
 | 
					            'default_template_id': template_id, | 
				
			||||
 | 
					            'default_composition_mode': 'comment', | 
				
			||||
 | 
					        }) | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        return { | 
				
			||||
 | 
					            'name': _('Compose Email'), | 
				
			||||
 | 
					            'type': 'ir.actions.act_window', | 
				
			||||
 | 
					            'view_type': 'form', | 
				
			||||
 | 
					            'view_mode': 'form', | 
				
			||||
 | 
					            'res_model': 'mail.compose.message', | 
				
			||||
 | 
					            'views': [(compose_form_id, 'form')], | 
				
			||||
 | 
					            'view_id': compose_form_id, | 
				
			||||
 | 
					            'target': 'new', | 
				
			||||
 | 
					            'context': ctx, | 
				
			||||
 | 
					        } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @api.multi | 
				
			||||
 | 
					    def button_confirm_action(self): | 
				
			||||
 | 
					        self.write({'stages_id': 'confirm'}) | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @api.multi | 
				
			||||
 | 
					    def button_resolved_action(self): | 
				
			||||
 | 
					        self.write({'stages_id': 'resolved'}) | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @api.multi | 
				
			||||
 | 
					    def button_cancel_action(self): | 
				
			||||
 | 
					        self.write({'stages_id': 'cancelled'}) | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					_logger = logging.getLogger(__name__) | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					class IrCron(models.Model): | 
				
			||||
 | 
					    _inherit = "ir.cron" | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @api.model | 
				
			||||
 | 
					    def _handle_callback_exception( | 
				
			||||
 | 
					            self, model_name, method_name, args, job_id, job_exception): | 
				
			||||
 | 
					        res = super(IrCron, self)._handle_callback_exception( | 
				
			||||
 | 
					            model_name, method_name, args, job_id, job_exception) | 
				
			||||
 | 
					        my_cron = self.browse(job_id) | 
				
			||||
 | 
					        self.env['logs.action'].create({ | 
				
			||||
 | 
					            'name': my_cron.name, | 
				
			||||
 | 
					            'method': my_cron.model, | 
				
			||||
 | 
					            'object_action': my_cron.function, | 
				
			||||
 | 
					            'exec_date': datetime.datetime.now(), | 
				
			||||
 | 
					            'error_details': str(job_exception), | 
				
			||||
 | 
					        }) | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        return res | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @api.model | 
				
			||||
 | 
					    def _test_scheduler_failure(self): | 
				
			||||
 | 
					        """This function is used to test and debug this module""" | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        raise UserError( | 
				
			||||
 | 
					            _("Task failure with UID = %d.") % self._uid) | 
				
			||||
| 
		 After Width: | Height: | Size: 144 KiB  | 
| 
		 After Width: | Height: | Size: 50 KiB  | 
| 
		 After Width: | Height: | Size: 12 KiB  | 
@ -0,0 +1,71 @@ | 
				
			|||||
 | 
					<section class="oe_container"> | 
				
			||||
 | 
					    <div class="oe_row oe_spaced"> | 
				
			||||
 | 
					        <h2 class="oe_slogan">Cron Job Failure Notification</h2> | 
				
			||||
 | 
					        <h3 class="oe_slogan"><center>Error Logs for Scheduled Actions/Cron jobs running in backend server.</center></h3> | 
				
			||||
 | 
					        <h4 class="oe_slogan">Cybrosys Technologies , www.cybrosys.com</h4> | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    </div> | 
				
			||||
 | 
					    <div> | 
				
			||||
 | 
					        <h4><p>Major Features:</p></h4> | 
				
			||||
 | 
					        <ul> | 
				
			||||
 | 
					           <li style="list-style:none !important;"><span style="color:green;"> →</span>   Creating Failure History for All Jobs in Backend.</li> | 
				
			||||
 | 
					            <li style="list-style:none !important;"><span style="color:green;"> →</span>   Failure Report Will Automatically Logged.</li> | 
				
			||||
 | 
					            <li style="list-style:none !important;"><span style="color:green;"> →</span>   Administrator Can Review Logs.</li> | 
				
			||||
 | 
					            <li style="list-style:none !important;"><span style="color:green;"> →</span>   Send Report to Support/Technical Team by Email Button.</li> | 
				
			||||
 | 
					            <li style="list-style:none !important;"><span style="color:green;"> →</span>   Custom Email Template for Sending Mail with Failure Details.</li> | 
				
			||||
 | 
					        </ul> | 
				
			||||
 | 
					    </div> | 
				
			||||
 | 
					</section> | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					<section class="oe_container oe_dark"> | 
				
			||||
 | 
					    <h3 class="oe_slogan">Error Logs Scheduled Actions - Form View</h3> | 
				
			||||
 | 
					    <div class="oe_bg_img"> | 
				
			||||
 | 
					        <img class="oe_picture oe_screenshot" src="logs_form_view.png"> | 
				
			||||
 | 
					    </div> | 
				
			||||
 | 
					</section> | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					<section class="oe_container"> | 
				
			||||
 | 
					    <h3 class="oe_slogan">Print PDF Report- Error Logs Scheduled</h3> | 
				
			||||
 | 
					    <div class="oe_bg_img"> | 
				
			||||
 | 
					        <img class="oe_picture oe_screenshot" src="logs_pdf_report.png"> | 
				
			||||
 | 
					    </div> | 
				
			||||
 | 
					</section> | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					<section class="oe_container oe_dark"> | 
				
			||||
 | 
					    <h3 class="oe_slogan">Send By Email - Error Logs Scheduled Actions Attaching PDF Report</h3> | 
				
			||||
 | 
					    <div class="oe_bg_img"> | 
				
			||||
 | 
					        <img class="oe_picture oe_screenshot" src="logs_mail_template.png"> | 
				
			||||
 | 
					    </div> | 
				
			||||
 | 
					</section> | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					<section class="oe_container"> | 
				
			||||
 | 
					    <h3 class="oe_slogan" style="text-align:left;padding-left: 23px;">How to test this module ?</h3> | 
				
			||||
 | 
					    <div> | 
				
			||||
 | 
					        <p> | 
				
			||||
 | 
					            <ul> | 
				
			||||
 | 
					                <li>Activate Developer mode.</li> | 
				
			||||
 | 
					                <li>Go to Settings --> Technical --> Automation --> Scheduled actions.</li> | 
				
			||||
 | 
					                <li>Select the record "Test Cron Failure Notification" and check active button.</li> | 
				
			||||
 | 
					                <li>Click the button 'Run Manually'.</li> | 
				
			||||
 | 
					                <li>A log of scheduler failure will be created under the menu 'Logs Scheduled Actions'.</li> | 
				
			||||
 | 
					                <li>For more details, Please see the README.rst file with this module.</li> | 
				
			||||
 | 
					            </ul> | 
				
			||||
 | 
					        </p> | 
				
			||||
 | 
					    </div> | 
				
			||||
 | 
					</section> | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					<section class="oe_container oe_dark"> | 
				
			||||
 | 
					    <h2 class="oe_slogan" style="margin-top:20px;" >Need Any Help?</h2> | 
				
			||||
 | 
					    <div class="oe_slogan" style="margin-top:10px !important;"> | 
				
			||||
 | 
					        <a  class="btn btn-primary btn-lg mt8" | 
				
			||||
 | 
					            style="color: #FFFFFF !important;" href="http://www.cybrosys.com"><i | 
				
			||||
 | 
					            class="fa fa-envelope"></i> Email </a> <a | 
				
			||||
 | 
					            class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;" | 
				
			||||
 | 
					            href="http://www.cybrosys.com/contact/"><i | 
				
			||||
 | 
					            class="fa fa-phone"></i> Contact Us </a> <a | 
				
			||||
 | 
					            class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;" | 
				
			||||
 | 
					            href="http://www.cybrosys.com/odoo-customization-and-installation/"><i | 
				
			||||
 | 
					            class="fa fa-check-square"></i> Request Customization </a> | 
				
			||||
 | 
					    </div> | 
				
			||||
 | 
					            <img src="cybro_logo.png" style="width: 190px; margin-bottom: 20px;" class="center-block"> | 
				
			||||
 | 
					</section> | 
				
			||||
| 
		 After Width: | Height: | Size: 93 KiB  | 
| 
		 After Width: | Height: | Size: 94 KiB  | 
| 
		 After Width: | Height: | Size: 41 KiB  | 
@ -0,0 +1,54 @@ | 
				
			|||||
 | 
					<?xml version="1.0" encoding="utf-8"?> | 
				
			||||
 | 
					<openerp> | 
				
			||||
 | 
					    <data> | 
				
			||||
 | 
					        <template id="report_log_error"> | 
				
			||||
 | 
					            <t t-call="report.html_container"> | 
				
			||||
 | 
					                <t t-call="report.internal_layout"> | 
				
			||||
 | 
					                    <div class="page"> | 
				
			||||
 | 
					                        <p t-esc="res_company.name"/> | 
				
			||||
 | 
					                        <h2> | 
				
			||||
 | 
					                        <span t-field="doc.name"/> | 
				
			||||
 | 
					                        </h2> | 
				
			||||
 | 
					                        <table class="table"> | 
				
			||||
 | 
					                            <tbody> | 
				
			||||
 | 
					                                <tr t-if="doc.object_action"> | 
				
			||||
 | 
					                                    <th>Object:</th> | 
				
			||||
 | 
					                                    <td><span t-field="doc.object_action"/></td> | 
				
			||||
 | 
					                                </tr> | 
				
			||||
 | 
					                                <tr t-if="doc.method"> | 
				
			||||
 | 
					                                    <th>Method:</th> | 
				
			||||
 | 
					                                    <td><span t-field="doc.method"/></td> | 
				
			||||
 | 
					                                </tr> | 
				
			||||
 | 
					                                <tr t-if="doc.created_by"> | 
				
			||||
 | 
					                                    <th>Responsible user:</th> | 
				
			||||
 | 
					                                    <td><span t-field="doc.created_by"/></td> | 
				
			||||
 | 
					                                </tr> | 
				
			||||
 | 
					                                <tr t-if="doc.exec_date"> | 
				
			||||
 | 
					                                    <th>Execution Date Time:</th> | 
				
			||||
 | 
					                                    <td><span t-field="doc.exec_date"/></td> | 
				
			||||
 | 
					                                </tr> | 
				
			||||
 | 
					                                <tr t-if="doc.company_name"> | 
				
			||||
 | 
					                                    <th>Company:</th> | 
				
			||||
 | 
					                                    <td><span t-field="doc.company_name"/></td> | 
				
			||||
 | 
					                                </tr> | 
				
			||||
 | 
					                            </tbody> | 
				
			||||
 | 
					                        </table> | 
				
			||||
 | 
					                        <br/><br/> | 
				
			||||
 | 
					                        <strong><p>Error: </p></strong> | 
				
			||||
 | 
					                        <p t-field="doc.error_details"/> | 
				
			||||
 | 
					                    <div class="oe_structure"/> | 
				
			||||
 | 
					                    </div> | 
				
			||||
 | 
					                </t> | 
				
			||||
 | 
					            </t> | 
				
			||||
 | 
					        </template> | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        <template id="report_logs_details"> | 
				
			||||
 | 
					            <t t-call="report.html_container"> | 
				
			||||
 | 
					                <t t-foreach="docs" t-as="doc"> | 
				
			||||
 | 
					                    <t t-call="cron_failure_notification.report_log_error" /> | 
				
			||||
 | 
					                </t> | 
				
			||||
 | 
					            </t> | 
				
			||||
 | 
					        </template> | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    </data> | 
				
			||||
 | 
					</openerp> | 
				
			||||
@ -0,0 +1,25 @@ | 
				
			|||||
 | 
					<?xml version="1.0" encoding="utf-8"?> | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					<openerp> | 
				
			||||
 | 
					    <data noupdate="1"> | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        <!-- Error Email template  --> | 
				
			||||
 | 
					        <record id="scheduler_error_mailer" model="mail.template"> | 
				
			||||
 | 
					            <field name="name">Scheduler Error</field> | 
				
			||||
 | 
					            <field name="email_from">${object.user_id.email}</field> | 
				
			||||
 | 
					            <field name="subject">'${object.name}' FAILED</field> | 
				
			||||
 | 
					            <field name="report_template" ref="action_report_logs"/> | 
				
			||||
 | 
					            <field name="model_id" ref="cron_failure_notification.model_logs_action"/> | 
				
			||||
 | 
					            <field name="auto_delete" eval="True"/> | 
				
			||||
 | 
					            <field name="body_html"> | 
				
			||||
 | 
					                <![CDATA[ | 
				
			||||
 | 
					                Dear Support team,<br> | 
				
			||||
 | 
					                <p>Here we are attaching error logs from scheduled cron jobs on our server, so please | 
				
			||||
 | 
					                urgently take action.<br> If you have any question, don't hesitate to contact us.<br></p><br> | 
				
			||||
 | 
					                Thank You. | 
				
			||||
 | 
					                ]]> | 
				
			||||
 | 
					            </field> | 
				
			||||
 | 
					        </record> | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    </data> | 
				
			||||
 | 
					</openerp> | 
				
			||||
@ -0,0 +1,77 @@ | 
				
			|||||
 | 
					<?xml version="1.0" encoding="utf-8"?> | 
				
			||||
 | 
					<openerp> | 
				
			||||
 | 
					    <data> | 
				
			||||
 | 
					        <record model="ir.ui.view" id="developer_mode_active_form"> | 
				
			||||
 | 
					            <field name="name">DeveloperMode</field> | 
				
			||||
 | 
					            <field name="model"></field> | 
				
			||||
 | 
					            <field name="inherit_id" ref="web.login"/> | 
				
			||||
 | 
					            <field name="arch" type="xml"> | 
				
			||||
 | 
					                <xpath expr="//input[@name='redirect']" position='attributes'> | 
				
			||||
 | 
					                    <attribute name="t-att-value">'%s%sdebug=1' % (redirect or '/web', redirect and '?' in redirect and '&' or '?')</attribute> | 
				
			||||
 | 
					                </xpath> | 
				
			||||
 | 
					            </field> | 
				
			||||
 | 
					        </record> | 
				
			||||
 | 
					        <record id="logs_form_view" model="ir.ui.view"> | 
				
			||||
 | 
					            <field name="name">logs.action.form</field> | 
				
			||||
 | 
					            <field name="model">logs.action</field> | 
				
			||||
 | 
					            <field name="view_type">form</field> | 
				
			||||
 | 
					            <field name="view_type">form</field> | 
				
			||||
 | 
					            <field name="arch" type="xml"> | 
				
			||||
 | 
					                <form string="Logs"> | 
				
			||||
 | 
					                    <header> | 
				
			||||
 | 
					                        <button name="button_confirm_action" string="Confirm" type="object" class="oe_highlight" attrs="{'invisible': [('stages_id', '!=', 'new')]}"/> | 
				
			||||
 | 
					                        <button name="button_cancel_action" string="Cancel" type="object" attrs="{'invisible': [('stages_id', '!=', 'new')]}"/> | 
				
			||||
 | 
					                        <button name="button_resolved_action" string="Resolve" type="object" class="oe_highlight" attrs="{'invisible': [('stages_id', '!=', 'confirm')]}"/> | 
				
			||||
 | 
					                        <button name="action_mail_send" string="Send By Email" type="object" context="{'send_mail':True}" class="oe_highlight" attrs="{'invisible': [('stages_id', '!=', 'confirm')]}"/> | 
				
			||||
 | 
					                        <field name="stages_id" widget="statusbar"/> | 
				
			||||
 | 
					                    </header> | 
				
			||||
 | 
					                    <sheet string="Logs"> | 
				
			||||
 | 
					                        <group> | 
				
			||||
 | 
					                            <group> | 
				
			||||
 | 
					                                <field name="name"/> | 
				
			||||
 | 
					                                <field name="method"/> | 
				
			||||
 | 
					                                <field name="created_by"/> | 
				
			||||
 | 
					                            </group> | 
				
			||||
 | 
					                            <group> | 
				
			||||
 | 
					                                <field name="object_action"/> | 
				
			||||
 | 
					                                <field name="exec_date"/> | 
				
			||||
 | 
					                                <field name="company_name"/> | 
				
			||||
 | 
					                            </group> | 
				
			||||
 | 
					                        </group> | 
				
			||||
 | 
					                        <notebook> | 
				
			||||
 | 
					                            <page name="error_info" string="Error"> | 
				
			||||
 | 
					                                <field name="error_details"/> | 
				
			||||
 | 
					                            </page> | 
				
			||||
 | 
					                        </notebook> | 
				
			||||
 | 
					                    </sheet> | 
				
			||||
 | 
					                    <div class="oe_chatter"> | 
				
			||||
 | 
					                        <field name="message_follower_ids" widget="mail_followers" groups="base.group_user"/> | 
				
			||||
 | 
					                        <field name="message_ids" widget="mail_thread"/> | 
				
			||||
 | 
					                    </div> | 
				
			||||
 | 
					                </form> | 
				
			||||
 | 
					            </field> | 
				
			||||
 | 
					        </record> | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        <record model="ir.ui.view" id="logs_tree_view"> | 
				
			||||
 | 
					            <field name="name">logs.action.tree</field> | 
				
			||||
 | 
					            <field name="model">logs.action</field> | 
				
			||||
 | 
					            <field name="arch" type="xml"> | 
				
			||||
 | 
					                <tree string="Logs"> | 
				
			||||
 | 
					                    <field name="name"/> | 
				
			||||
 | 
					                    <field name="exec_date"/> | 
				
			||||
 | 
					                    <field name="stages_id"/> | 
				
			||||
 | 
					                </tree> | 
				
			||||
 | 
					            </field> | 
				
			||||
 | 
					        </record> | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        <record id="ir_cron_act_logs" model="ir.actions.act_window"> | 
				
			||||
 | 
					            <field name="name">Logs Scheduled Actions</field> | 
				
			||||
 | 
					            <field name="res_model">logs.action</field> | 
				
			||||
 | 
					            <field name="view_type">form</field> | 
				
			||||
 | 
					            <field name="view_mode">form,tree</field> | 
				
			||||
 | 
					            <field name="view_id" ref="logs_tree_view"/> | 
				
			||||
 | 
					        </record> | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        <menuitem id="menu_ir_cron_logs" action="ir_cron_act_logs" parent="base.menu_automation"/> | 
				
			||||
 | 
					    </data> | 
				
			||||
 | 
					</openerp> | 
				
			||||
@ -0,0 +1,12 @@ | 
				
			|||||
 | 
					<openerp> | 
				
			||||
 | 
					    <data> | 
				
			||||
 | 
					         <report id="action_report_logs" | 
				
			||||
 | 
					                 model="logs.action" | 
				
			||||
 | 
					                 string="Print Log Scheduled" | 
				
			||||
 | 
					                 report_type="qweb-pdf" | 
				
			||||
 | 
					                 file="cron_failure_notification.report_logs_details" | 
				
			||||
 | 
					                 name="cron_failure_notification.report_logs_details" | 
				
			||||
 | 
					                 menu="True" | 
				
			||||
 | 
					         /> | 
				
			||||
 | 
					    </data> | 
				
			||||
 | 
					</openerp> | 
				
			||||
					Loading…
					
					
				
		Reference in new issue