Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[18.0][MIG] scheduler_error_mailer #3084

Open
wants to merge 51 commits into
base: 18.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
451ceff
[INIT] intial import
sebastienbeau Feb 24, 2011
9953103
Now uses an email template instead of a simple mail
davbea Jun 4, 2012
d3b5f2b
Port to OpenERP 7.0.
Sep 29, 2013
c8a8d39
Generate .pot files
Mar 14, 2014
fec00b2
move all modules to __unported__ on master branch and set installable…
sbidoul Jul 12, 2014
4242ae8
[MIG] scheduler_error_mailer: Migration to v8
Sep 16, 2014
f6a952a
[FIX] renamed 'email_template' m2o field in 'email_template_id' in sc…
bealdav Sep 15, 2014
db50950
[MIG][9.0] scheduler_error_mailer
atchuthan May 18, 2016
c7a25f8
migrate to V10
EBII Feb 3, 2017
a0527d6
[FIX] scheduler error mailer font typo (#765)
ateijelo Mar 21, 2017
0974c07
[MIG] scheduler_error_mailer: Migration to 11.0
AMhadhbi Jun 21, 2018
4b1f99e
[12.0][MIG] scheduler_error_mailer: Migration to v12
cristinamartinrod Mar 4, 2019
7342eeb
Added translation using Weblate (Portuguese)
pedrocs-exo Aug 14, 2019
fa6fe48
Translated using Weblate (Portuguese)
pedrocs-exo Aug 14, 2019
ef92ea2
Translated using Weblate (Portuguese (Brazil))
Aug 30, 2019
91305f3
Translated using Weblate (Chinese (Simplified))
liweijie0812 Aug 31, 2019
4cf9c3a
Translated using Weblate (Portuguese (Brazil))
Sep 2, 2019
cf30ff6
Added translation using Weblate (French)
ypapouin Oct 20, 2021
5231748
[FIX] scheduler_error_mailer: fixed email template fields
aleuffre Sep 14, 2021
c307788
[IMP] scheduler_error_mailer: black, isort, prettier
victoralmau Jan 26, 2022
e7f3135
[MIG] scheduler_error_mailer: Migration to 13.0
mhachraf Feb 26, 2020
d3f6e8b
[UPD] Update scheduler_error_mailer.pot
oca-travis Jan 27, 2022
b9788fb
[UPD] README.rst
OCA-git-bot Jan 27, 2022
ccd9bd9
[UPD] Update scheduler_error_mailer.pot
oca-travis Sep 1, 2022
77293ec
Update translation files
oca-transbot Sep 1, 2022
bf177d9
[IMP] scheduler_error_mailer: black, isort, prettier
ernesto-garcia-tecnativa Feb 13, 2023
be88365
[MIG] scheduler_error_mailer: Migration to 15.0
ernesto-garcia-tecnativa Feb 13, 2023
d6c07e0
[UPD] Update scheduler_error_mailer.pot
Feb 14, 2023
46200b9
[UPD] README.rst
OCA-git-bot Feb 14, 2023
480188f
Update translation files
weblate Feb 15, 2023
ab65f2b
Translated using Weblate (Spanish (Argentina))
ibuioli Mar 4, 2023
8e06ce6
[MIG] scheduler_error_mailer
hbrunn Apr 7, 2023
1597e30
[IMP] set default template
hbrunn May 16, 2023
ef08b9c
[ADD] tests
hbrunn May 16, 2023
e444b24
[UPD] Update scheduler_error_mailer.pot
Jun 8, 2023
f753012
[UPD] README.rst
OCA-git-bot Jun 8, 2023
f65319d
Update translation files
weblate Jun 8, 2023
1bd6a8a
Translated using Weblate (Spanish (Argentina))
ibuioli Jun 9, 2023
c9a60d1
Translated using Weblate (Spanish)
Ivorra78 Aug 27, 2023
6002961
[UPD] README.rst
OCA-git-bot Sep 3, 2023
a89ae92
Update translation files
weblate Oct 9, 2023
c27fb42
[IMP] scheduler_error_mailer: pre-commit auto fixes
cuongnmtm Dec 29, 2023
fee4fb5
[MIG] scheduler_error_mailer: Migration to 17.0
cuongnmtm Dec 29, 2023
5ee1385
[UPD] Update scheduler_error_mailer.pot
Feb 2, 2024
44315c9
[BOT] post-merge updates
OCA-git-bot Feb 2, 2024
0a87cc7
Update translation files
weblate Feb 3, 2024
722e148
Added translation using Weblate (Italian)
mymage Feb 6, 2024
4cf0d1e
Translated using Weblate (Italian)
mymage Feb 6, 2024
69c0ae5
Translated using Weblate (Chinese (Simplified) (zh_CN))
xtanuiha Jun 16, 2024
c05bc06
[MIG] scheduler_error_mailer: pre-commit
astirpe Oct 17, 2024
fb57bb5
[MIG] scheduler_error_mailer: migrate to V18
astirpe Oct 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 99 additions & 0 deletions scheduler_error_mailer/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
======================
Scheduler Error Mailer
======================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:f13d86592670711096f7ef648335a713566dde20d34a0de5a2be7855b46624ef
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
: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/18.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-18-0/server-tools-18-0-scheduler_error_mailer
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-tools&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module adds the possibility to send an e-mail when a scheduler
raises an error.

**Table of contents**

.. contents::
:local:

Configuration
=============

To configure this module, you need to:

1. Go to Settings -> Technical -> Automation -> Scheduled Actions
2. Choose the scheduled Actions you want to send the error email and
select the E-mail Template in the Error E-mail Template field.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-tools/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`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**>`_.

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

Credits
=======

Authors
-------

* Akretion
* Sodexis

Contributors
------------

- Sébastien BEAU <[email protected]>
- David Beal <[email protected]>
- Alexis de Lattre <[email protected]>
- Sodexis <[email protected]>
- Achraf Mhadhbi <[email protected]>
- `Tecnativa <https://www.tecnativa.com>`__:

- Cristina Martin R.
- Víctor Martínez

- `Komit <https://komit-consulting.com>`__:

- Cuong NGUYEN MINH TRAN MANH

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

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 <https://github.com/OCA/server-tools/tree/18.0/scheduler_error_mailer>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 4 additions & 0 deletions scheduler_error_mailer/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import models
from .hooks import post_init_hook
20 changes: 20 additions & 0 deletions scheduler_error_mailer/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2012-2013 Akretion Sébastien BEAU,David Beal,Alexis de Lattre
# Copyright 2016 Sodexis
# Copyright 2018 bloopark systems (<http://bloopark.de>)
# Copyright 2019 Tecnativa - Cristina Martin R.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Scheduler Error Mailer",
"version": "18.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"],
"demo": ["demo/ir_cron_demo.xml"],
"images": ["images/scheduler_error_mailer.jpg"],
"installable": True,
"post_init_hook": "post_init_hook",
}
42 changes: 42 additions & 0 deletions scheduler_error_mailer/data/ir_cron_email_tpl.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo 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 or ''}}</field>
<field name="email_to">{{object.user_id.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_html">
<![CDATA[
<div style="font-family: 'Lucida Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; ">

<p>Odoo tried to run the scheduler <em><t t-out="object.name or ''"/></em> in the database <em><t t-out="ctx.get('dbname')"/></em> but it failed. Here is the error message :</p>

<strong>
<t t-out="ctx.get('job_exception') or 'Failed to get the error message from the context.'"/>
</strong>

<p>You may check the logs of the Odoo server to get more information about this failure.</p>

<p>Properties of the scheduler <em><t t-out="object.name or ''"/></em> :</p>
<ul>
<li>Model : <t t-out="object.model_id.name or ''"/></li>
<li>Python code : <code><t t-out="object.code or ''"/></code></li>
<li>Interval : <t t-out="object.interval_number or '0'"/> <t t-out="object.interval_type or ''"/></li>
<li>User : <t t-out="object.user_id.name or ''"/></li>
</ul>

<p>
-- <br/>
Automatic e-mail sent by Odoo. Do not reply.<br/>
Database : <t t-out="ctx.get('dbname')"/>
</p>
</div>
]]>
</field>
</record>
</odoo>
24 changes: 24 additions & 0 deletions scheduler_error_mailer/demo/ir_cron_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
scheduler_error_mailer for Odoo
Copyright (C) 2012-2013 Akretion Sébastien BEAU,David Beal,Alexis de Lattre
Copyright (C) 2016 Sodexis
Copyright (C) 2018 bloopark systems (<http://bloopark.de>)
The licence is in the file __openerp__.py
-->
<odoo 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="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"
/>
</record>
</odoo>
14 changes: 14 additions & 0 deletions scheduler_error_mailer/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2023 Hunki Enterprises BV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import SUPERUSER_ID, api


def post_init_hook(env):
env = api.Environment(env.cr, SUPERUSER_ID, {})
env["ir.cron"].with_context(active_test=False).search([]).write(
{
"email_template_id": env.ref(
"scheduler_error_mailer.scheduler_error_mailer"
).id
}
)
110 changes: 110 additions & 0 deletions scheduler_error_mailer/i18n/de.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * scheduler_error_mailer
#
# Translators:
# Niki Waibel <[email protected]>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-02-08 03:37+0000\n"
"PO-Revision-Date: 2017-02-08 03:37+0000\n"
"Last-Translator: Niki Waibel <[email protected]>, 2017\n"
"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#. module: scheduler_error_mailer
#: model:mail.template,body_html:scheduler_error_mailer.scheduler_error_mailer
msgid ""
"\n"
" \n"
"<div style=\"font-family: 'Lucida Grande', Ubuntu, Arial, Verdana, sans-"
"serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; \">\n"
"\n"
"<p>Odoo tried to run the scheduler <em><t t-out=\"object.name or ''\"/></em> "
"in the database <em><t t-out=\"ctx.get('dbname')\"/></em> but it failed. "
"Here is the error message :</p>\n"
"\n"
"<strong>\n"
"<t t-out=\"ctx.get('job_exception') or 'Failed to get the error message from "
"the context.'\"/>\n"
"</strong>\n"
"\n"
"<p>You may check the logs of the Odoo server to get more information about "
"this failure.</p>\n"
"\n"
"<p>Properties of the scheduler <em><t t-out=\"object.name or ''\"/></em> :</"
"p>\n"
"<ul>\n"
"<li>Model : <t t-out=\"object.model_id.name or ''\"/></li>\n"
"<li>Python code : <code><t t-out=\"object.code or ''\"/></code></li>\n"
"<li>Interval : <t t-out=\"object.interval_number or '0'\"/> <t t-out="
"\"object.interval_type or ''\"/></li>\n"
"<li>Number of calls : <t t-out=\"object.numbercall or '0'\"/></li>\n"
"<li>Repeat missed : <t t-out=\"object.doall\"/></li>\n"
"<li>User : <t t-out=\"object.user_id.name or ''\"/></li>\n"
"</ul>\n"
"\n"
"<p>\n"
"-- <br/>\n"
"Automatic e-mail sent by Odoo. Do not reply.<br/>\n"
"Database : <t t-out=\"ctx.get('dbname')\"/>\n"
"</p>\n"
"</div>\n"
" \n"
" "
msgstr ""

#. module: scheduler_error_mailer
#: model:ir.model.fields,field_description:scheduler_error_mailer.field_ir_cron__email_template_id
msgid "Error E-mail Template"
msgstr "Fehler e-Mail Vorlage"

#. module: scheduler_error_mailer
#: model:ir.model,name:scheduler_error_mailer.model_ir_cron
msgid "Scheduled Actions"
msgstr ""

#. module: scheduler_error_mailer
#: model:mail.template,name:scheduler_error_mailer.scheduler_error_mailer
msgid "Scheduler Error"
msgstr ""

#. module: scheduler_error_mailer
#: model:ir.model.fields,help:scheduler_error_mailer.field_ir_cron__email_template_id
msgid "Select the email template that will be sent when this scheduler fails."
msgstr ""
"Wähle die e-Mail Vorlage welche bei einem Fehler dieses Schedulers gesendet "
"wird."

#. module: scheduler_error_mailer
#. odoo-python
#: code:addons/scheduler_error_mailer/models/ir_cron.py:0
#, python-format
msgid "Task failure with UID = %d."
msgstr "Task Fehler von UID = %d."

#. module: scheduler_error_mailer
#: model:ir.actions.server,name:scheduler_error_mailer.test_scheduler_error_mailer_ir_actions_server
msgid "Test Scheduler Error Mailer"
msgstr ""

#. module: scheduler_error_mailer
#: model:mail.template,subject:scheduler_error_mailer.scheduler_error_mailer
msgid "[DB {{ctx.get('dbname')}}] Scheduler '{{object.name or ''}}' FAILED"
msgstr ""

#~ msgid "[DB ${ctx.get('dbname')}] Scheduler '${object.name or ''}' FAILED"
#~ msgstr "[DB ${ctx.get('dbname')}] Scheduler '${object.name or ''}' FEHLER"

#, fuzzy
#~ msgid "Email Template"
#~ msgstr "Fehler e-Mail Vorlage"

#~ msgid "ir.cron"
#~ msgstr "ir.cron"
Loading
Loading