diff --git a/scheduler_error_mailer/README.rst b/scheduler_error_mailer/README.rst index b5dbb228a..78297aef5 100644 --- a/scheduler_error_mailer/README.rst +++ b/scheduler_error_mailer/README.rst @@ -14,13 +14,13 @@ Scheduler Error Mailer :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github - :target: https://github.com/OCA/server-tools/tree/12.0/scheduler_error_mailer + :target: https://github.com/OCA/server-tools/tree/13.0/scheduler_error_mailer :alt: OCA/server-tools .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/server-tools-12-0/server-tools-12-0-scheduler_error_mailer + :target: https://translation.odoo-community.org/projects/server-tools-13-0/server-tools-13-0-scheduler_error_mailer :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/149/12.0 + :target: https://runbot.odoo-community.org/runbot/149/13.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -47,7 +47,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -72,6 +72,7 @@ Contributors * `Tecnativa `_: * Cristina Martin R. + * Víctor Martínez Maintainers ~~~~~~~~~~~ @@ -86,6 +87,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -This module is part of the `OCA/server-tools `_ project on GitHub. +This module is part of the `OCA/server-tools `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/scheduler_error_mailer/__manifest__.py b/scheduler_error_mailer/__manifest__.py index 5b2c05cb1..8649d8165 100644 --- a/scheduler_error_mailer/__manifest__.py +++ b/scheduler_error_mailer/__manifest__.py @@ -6,13 +6,13 @@ { "name": "Scheduler Error Mailer", - "version": "12.0.1.2.0", + "version": "13.0.1.0.0", "category": "Extra Tools", "license": "AGPL-3", "author": "Akretion,Sodexis,Odoo Community Association (OCA)", "website": "https://github.com/OCA/server-tools", "depends": ["mail"], - "data": ["data/ir_cron_email_tpl.xml", "views/ir_cron.xml",], + "data": ["data/ir_cron_email_tpl.xml", "views/ir_cron.xml"], "demo": ["demo/ir_cron_demo.xml"], "images": ["images/scheduler_error_mailer.jpg"], "installable": True, diff --git a/scheduler_error_mailer/migrations/12.0.1.1.0/post-migration.py b/scheduler_error_mailer/migrations/12.0.1.1.0/post-migration.py deleted file mode 100644 index 1b013bcd0..000000000 --- a/scheduler_error_mailer/migrations/12.0.1.1.0/post-migration.py +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright 2021 Tecnativa - Víctor Martínez -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -from openupgradelib import openupgrade - - -@openupgrade.migrate() -def migrate(env, version): - template = env.ref("scheduler_error_mailer.scheduler_error_mailer") - template.body_html = template.body_html.replace( - "${ctx.get('job_exception') and ctx.get('job_exception').value", - "${ctx.get('job_exception')", - ) diff --git a/scheduler_error_mailer/migrations/12.0.1.2.0/post-migration.py b/scheduler_error_mailer/migrations/12.0.1.2.0/post-migration.py deleted file mode 100644 index b38dd7941..000000000 --- a/scheduler_error_mailer/migrations/12.0.1.2.0/post-migration.py +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2021 Tecnativa - Víctor Martínez -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -from openupgradelib import openupgrade - - -@openupgrade.migrate() -def migrate(env, version): - template = env.ref("scheduler_error_mailer.scheduler_error_mailer") - template.body_html = template.body_html.replace( - "${object.model or ''}", "${object.model_id.name or ''}" - ) - template.body_html = template.body_html.replace( - "
  • Method : ${object.function or ''}
  • ", "" - ) - template.body_html = template.body_html.replace( - "
  • Arguments : ${object.args or ''}
  • ", - "
  • Python code : ${object.code or ''}
  • ", - ) diff --git a/scheduler_error_mailer/models/ir_cron.py b/scheduler_error_mailer/models/ir_cron.py index 74a699a1f..7756af433 100644 --- a/scheduler_error_mailer/models/ir_cron.py +++ b/scheduler_error_mailer/models/ir_cron.py @@ -25,7 +25,7 @@ class IrCron(models.Model): def _handle_callback_exception( self, cron_name, server_action_id, job_id, job_exception ): - res = super(IrCron, self)._handle_callback_exception( + res = super()._handle_callback_exception( cron_name, server_action_id, job_id, job_exception ) my_cron = self.browse(job_id) @@ -33,16 +33,12 @@ class IrCron(models.Model): if my_cron.email_template_id: # we put the job_exception in context to be able to print it inside # the email template - context = { - "job_exception": str(job_exception), - "dbname": self._cr.dbname, - } + context = {"job_exception": str(job_exception), "dbname": self._cr.dbname} _logger.debug("Sending scheduler error email with context=%s", context) - self.env["mail.template"].browse(my_cron.email_template_id.id).with_context( - context - ).sudo().send_mail(my_cron.id, force_send=True) + template = my_cron.email_template_id.with_context(context).sudo() + template.send_mail(my_cron.id, force_send=True) return res diff --git a/scheduler_error_mailer/readme/CONTRIBUTORS.rst b/scheduler_error_mailer/readme/CONTRIBUTORS.rst index 496cedb9f..afcb6d058 100644 --- a/scheduler_error_mailer/readme/CONTRIBUTORS.rst +++ b/scheduler_error_mailer/readme/CONTRIBUTORS.rst @@ -7,3 +7,4 @@ * `Tecnativa `_: * Cristina Martin R. + * Víctor Martínez diff --git a/scheduler_error_mailer/static/description/index.html b/scheduler_error_mailer/static/description/index.html index 2586581cf..0977e4b35 100644 --- a/scheduler_error_mailer/static/description/index.html +++ b/scheduler_error_mailer/static/description/index.html @@ -3,7 +3,7 @@ - + Scheduler Error Mailer