Skip to content

Commit da5b58b

Browse files
quoc-pncuongnmtm
authored andcommitted
[MIG] scheduler_error_mailer: Migration to 19.0
1 parent 43b42d4 commit da5b58b

5 files changed

Lines changed: 28 additions & 12 deletions

File tree

scheduler_error_mailer/README.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ Scheduler Error Mailer
2121
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
2222
:alt: License: AGPL-3
2323
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github
24-
:target: https://github.com/OCA/server-tools/tree/18.0/scheduler_error_mailer
24+
:target: https://github.com/OCA/server-tools/tree/19.0/scheduler_error_mailer
2525
:alt: OCA/server-tools
2626
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
27-
:target: https://translation.odoo-community.org/projects/server-tools-18-0/server-tools-18-0-scheduler_error_mailer
27+
:target: https://translation.odoo-community.org/projects/server-tools-19-0/server-tools-19-0-scheduler_error_mailer
2828
:alt: Translate me on Weblate
2929
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
30-
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-tools&target_branch=18.0
30+
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-tools&target_branch=19.0
3131
:alt: Try me on Runboat
3232

3333
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -55,7 +55,7 @@ Bug Tracker
5555
Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-tools/issues>`_.
5656
In case of trouble, please check there if your issue has already been reported.
5757
If you spotted it first, help us to smash it by providing a detailed and welcomed
58-
`feedback <https://github.com/OCA/server-tools/issues/new?body=module:%20scheduler_error_mailer%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
58+
`feedback <https://github.com/OCA/server-tools/issues/new?body=module:%20scheduler_error_mailer%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
5959

6060
Do not contact contributors directly about support or help with technical issues.
6161

@@ -98,6 +98,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
9898
mission is to support the collaborative development of Odoo features and
9999
promote its widespread use.
100100

101-
This module is part of the `OCA/server-tools <https://github.com/OCA/server-tools/tree/18.0/scheduler_error_mailer>`_ project on GitHub.
101+
This module is part of the `OCA/server-tools <https://github.com/OCA/server-tools/tree/19.0/scheduler_error_mailer>`_ project on GitHub.
102102

103103
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

scheduler_error_mailer/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
{
88
"name": "Scheduler Error Mailer",
9-
"version": "18.0.1.0.0",
9+
"version": "19.0.1.0.0",
1010
"category": "Extra Tools",
1111
"license": "AGPL-3",
1212
"author": "Akretion,Sodexis,Odoo Community Association (OCA)",

scheduler_error_mailer/models/ir_cron.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ def _handle_callback_exception(self, cron_name, server_action_id, job_exception)
2929
if self.email_template_id:
3030
# we put the job_exception in context to be able to print it inside
3131
# the email template
32-
context = {"job_exception": str(job_exception), "dbname": self._cr.dbname}
32+
context = {
33+
"job_exception": str(job_exception),
34+
"dbname": self.env.cr.dbname,
35+
}
3336

3437
_logger.debug("Sending scheduler error email with context=%s", context)
3538

@@ -39,7 +42,9 @@ def _handle_callback_exception(self, cron_name, server_action_id, job_exception)
3942
@api.model
4043
def _test_scheduler_failure(self):
4144
"""This function is used to test and debug this module."""
42-
raise UserError(self.env._("Task failure with UID = %(uid)d.", uid=self._uid))
45+
raise UserError(
46+
self.env._("Task failure with UID = %(uid)d.", uid=self.env.uid)
47+
)
4348

4449
@api.model
4550
def _callback(self, cron_name, server_action_id):

scheduler_error_mailer/static/description/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ <h1>Scheduler Error Mailer</h1>
374374
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
375375
!! source digest: sha256:a8e6bce11d3a37dc2e2cbd48c0cd58bf158ffed0ee83994c75cdb0f5a55541b0
376376
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
377-
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/server-tools/tree/18.0/scheduler_error_mailer"><img alt="OCA/server-tools" src="https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/server-tools-18-0/server-tools-18-0-scheduler_error_mailer"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/server-tools&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
377+
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/server-tools/tree/19.0/scheduler_error_mailer"><img alt="OCA/server-tools" src="https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/server-tools-19-0/server-tools-19-0-scheduler_error_mailer"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/server-tools&amp;target_branch=19.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
378378
<p>This module adds the possibility to send an e-mail when a scheduler
379379
raises an error.</p>
380380
<p><strong>Table of contents</strong></p>
@@ -404,7 +404,7 @@ <h2><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h2>
404404
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/server-tools/issues">GitHub Issues</a>.
405405
In case of trouble, please check there if your issue has already been reported.
406406
If you spotted it first, help us to smash it by providing a detailed and welcomed
407-
<a class="reference external" href="https://github.com/OCA/server-tools/issues/new?body=module:%20scheduler_error_mailer%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
407+
<a class="reference external" href="https://github.com/OCA/server-tools/issues/new?body=module:%20scheduler_error_mailer%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
408408
<p>Do not contact contributors directly about support or help with technical issues.</p>
409409
</div>
410410
<div class="section" id="credits">
@@ -444,7 +444,7 @@ <h3><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h3>
444444
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
445445
mission is to support the collaborative development of Odoo features and
446446
promote its widespread use.</p>
447-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-tools/tree/18.0/scheduler_error_mailer">OCA/server-tools</a> project on GitHub.</p>
447+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-tools/tree/19.0/scheduler_error_mailer">OCA/server-tools</a> project on GitHub.</p>
448448
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
449449
</div>
450450
</div>

scheduler_error_mailer/tests/test_scheduler_error_mailer.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,18 @@
1010
class TestSchedulerErrorMailer(BaseCommon):
1111
def setUp(self):
1212
super().setUp()
13-
self.cron = self.env.ref("scheduler_error_mailer.test_scheduler_error_mailer")
13+
self.cron = self.env["ir.cron"].create(
14+
{
15+
"name": "Test Scheduler Error Mailer",
16+
"active": False,
17+
"user_id": self.env.ref("base.user_root").id,
18+
"interval_number": 1,
19+
"interval_type": "hours",
20+
"model_id": self.env.ref("base.model_ir_cron").id,
21+
"state": "code",
22+
"code": "model._test_scheduler_failure()",
23+
}
24+
)
1425

1526
def test_error_cron(self):
1627
with (

0 commit comments

Comments
 (0)