Browse Source

[MIG] scheduler_error_mailer: Migration to 11.0

pull/1297/head
Achref Mhadhbi 7 years ago
committed by Pedro M. Baeza
parent
commit
f6a4361f9b
  1. 3
      scheduler_error_mailer/README.rst
  2. 2
      scheduler_error_mailer/__manifest__.py
  3. 6
      scheduler_error_mailer/demo/ir_cron_demo.xml
  4. 2
      scheduler_error_mailer/models/__init__.py
  5. 18
      scheduler_error_mailer/models/ir_cron.py
  6. 3
      scheduler_error_mailer/views/ir_cron.xml

3
scheduler_error_mailer/README.rst

@ -24,7 +24,7 @@ To use this module, you need to:
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot :alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/149/10.0
:target: https://runbot.odoo-community.org/runbot/149/11.0
Bug Tracker Bug Tracker
=========== ===========
@ -49,6 +49,7 @@ Contributors
* David Beal <bealdavid@gmail.com> * David Beal <bealdavid@gmail.com>
* Alexis de Lattre <alexis.delattre@akretion.com> * Alexis de Lattre <alexis.delattre@akretion.com>
* Sodexis <dev@sodexis.com> * Sodexis <dev@sodexis.com>
* Achraf Mhadhbi <machraf@bloopark.de>
Maintainer Maintainer

2
scheduler_error_mailer/__manifest__.py

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# © 2012-2013 Akretion Sébastien BEAU,David Beal,Alexis de Lattre # © 2012-2013 Akretion Sébastien BEAU,David Beal,Alexis de Lattre
# © 2016 Sodexis # © 2016 Sodexis
# © 2018 bloopark systems (<http://bloopark.de>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{ {

6
scheduler_error_mailer/demo/ir_cron_demo.xml

@ -3,6 +3,7 @@
scheduler_error_mailer for Odoo scheduler_error_mailer for Odoo
Copyright (C) 2012-2013 Akretion Sébastien BEAU,David Beal,Alexis de Lattre Copyright (C) 2012-2013 Akretion Sébastien BEAU,David Beal,Alexis de Lattre
Copyright (C) 2016 Sodexis Copyright (C) 2016 Sodexis
Copyright (C) 2018 bloopark systems (<http://bloopark.de>)
The licence is in the file __openerp__.py The licence is in the file __openerp__.py
--> -->
@ -18,8 +19,9 @@
<field name="numbercall">-1</field> <field name="numbercall">-1</field>
<!-- don't limit the number of calls --> <!-- don't limit the number of calls -->
<field name="doall" eval="True"/> <field name="doall" eval="True"/>
<field name="model">ir.cron</field>
<field name="function">_test_scheduler_failure</field>
<field name="model_id" ref="model_ir_cron"/>
<field name="state">code</field>
<field name="code">model._test_scheduler_failure()</field>
<field name="email_template_id" ref="scheduler_error_mailer.scheduler_error_mailer"/> <field name="email_template_id" ref="scheduler_error_mailer.scheduler_error_mailer"/>
</record> </record>

2
scheduler_error_mailer/models/__init__.py

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# © 2012-2013 Akretion Sébastien BEAU,David Beal,Alexis de Lattre # © 2012-2013 Akretion Sébastien BEAU,David Beal,Alexis de Lattre
# © 2016 Sodexis # © 2016 Sodexis
# © 2018 bloopark systems (<http://bloopark.de>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import ir_cron from . import ir_cron

18
scheduler_error_mailer/models/ir_cron.py

@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
# © 2012-2013 Akretion Sébastien BEAU,David Beal,Alexis de Lattre # © 2012-2013 Akretion Sébastien BEAU,David Beal,Alexis de Lattre
# © 2016 Sodexis # © 2016 Sodexis
# © 2018 bloopark systems (<http://bloopark.de>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models, fields, api, _
from odoo import _, api, fields, models
from odoo.exceptions import UserError from odoo.exceptions import UserError
import logging import logging
@ -22,11 +22,12 @@ class IrCron(models.Model):
) )
@api.model @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)
def _handle_callback_exception(self, cron_name, server_action_id, job_id,
job_exception):
res = super(IrCron, self)._handle_callback_exception(cron_name,
server_action_id,
job_id,
job_exception)
my_cron = self.browse(job_id) my_cron = self.browse(job_id)
if my_cron.email_template_id: if my_cron.email_template_id:
@ -49,7 +50,6 @@ class IrCron(models.Model):
@api.model @api.model
def _test_scheduler_failure(self): def _test_scheduler_failure(self):
"""This function is used to test and debug this module"""
"""This function is used to test and debug this module."""
raise UserError( raise UserError(
_("Task failure with UID = %d.") % self._uid) _("Task failure with UID = %d.") % self._uid)

3
scheduler_error_mailer/views/ir_cron.xml

@ -3,6 +3,7 @@
scheduler_error_mailer for Odoo scheduler_error_mailer for Odoo
Copyright (C) 2012-2013 Akretion Sébastien BEAU,David Beal,Alexis de Lattre Copyright (C) 2012-2013 Akretion Sébastien BEAU,David Beal,Alexis de Lattre
Copyright (C) 2016 Sodexis Copyright (C) 2016 Sodexis
Copyright (C) 2018 bloopark systems (<http://bloopark.de>)
The licence is in the file __openerp__.py The licence is in the file __openerp__.py
--> -->
@ -11,7 +12,7 @@
<record id="ir_cron_view" model="ir.ui.view"> <record id="ir_cron_view" model="ir.ui.view">
<field name="name">ir.cron.error.mailer.form</field> <field name="name">ir.cron.error.mailer.form</field>
<field name="model">ir.cron</field> <field name="model">ir.cron</field>
<field name="inherit_id" ref="base.ir_cron_view"/>
<field name="inherit_id" ref="base.ir_cron_view_form"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="doall" position="after"> <field name="doall" position="after">
<field name="email_template_id"/> <field name="email_template_id"/>

Loading…
Cancel
Save