diff --git a/scheduler_error_mailer/data/ir_cron_email_tpl.xml b/scheduler_error_mailer/data/ir_cron_email_tpl.xml index 6635d080a..53f8efd09 100644 --- a/scheduler_error_mailer/data/ir_cron_email_tpl.xml +++ b/scheduler_error_mailer/data/ir_cron_email_tpl.xml @@ -1,46 +1,44 @@ - - - - - Scheduler Error - ${object.user_id.email or ''} - ${object.user_id.email or ''} - [DB ${ctx.get('dbname')}] Scheduler '${object.name or ''}' FAILED - - - + + + + Scheduler Error + {{object.user_id.email or ''}} + {{object.user_id.email or ''}} + [DB {{ctx.get('dbname')}}] Scheduler '{{object.name or ''}}' FAILED + + + -

Odoo tried to run the scheduler ${object.name or ''} in the database ${ctx.get('dbname')} but it failed. Here is the error message :

+

Odoo tried to run the scheduler in the database but it failed. Here is the error message :

-${ctx.get('job_exception') or 'Failed to get the error message from the context.'} +

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

-

Properties of the scheduler ${object.name or ''} :

+

Properties of the scheduler :

    -
  • Model : ${object.model_id.name or ''}
  • -
  • Python code : ${object.code or ''}
  • -
  • Interval : ${object.interval_number or '0'} ${object.interval_type or ''}
  • -
  • Number of calls : ${object.numbercall or '0'}
  • -
  • Repeat missed : ${object.doall}
  • -
  • User : ${object.user_id.name or ''}
  • +
  • Model :
  • +
  • Python code :
  • +
  • Interval :
  • +
  • Number of calls :
  • +
  • Repeat missed :
  • +
  • User :

--
Automatic e-mail sent by Odoo. Do not reply.
-Database : ${ctx.get('dbname')} +Database :

]]> -
-
-
+ +
diff --git a/scheduler_error_mailer/demo/ir_cron_demo.xml b/scheduler_error_mailer/demo/ir_cron_demo.xml index d7b10fb66..cb850e036 100644 --- a/scheduler_error_mailer/demo/ir_cron_demo.xml +++ b/scheduler_error_mailer/demo/ir_cron_demo.xml @@ -6,24 +6,22 @@ Copyright (C) 2018 bloopark systems () The licence is in the file __openerp__.py --> - - - - Test Scheduler Error Mailer - - - 1 - hours - -1 - - - - code - model._test_scheduler_failure() - - - + + + Test Scheduler Error Mailer + + + 1 + hours + -1 + + + + code + model._test_scheduler_failure() + + diff --git a/scheduler_error_mailer/models/ir_cron.py b/scheduler_error_mailer/models/ir_cron.py index 7756af433..eeb289873 100644 --- a/scheduler_error_mailer/models/ir_cron.py +++ b/scheduler_error_mailer/models/ir_cron.py @@ -16,6 +16,7 @@ class IrCron(models.Model): email_template_id = fields.Many2one( comodel_name="mail.template", + domain=[("model_id.model", "=", "ir.cron")], string="Error E-mail Template", help="Select the email template that will be sent when " "this scheduler fails.", @@ -37,7 +38,7 @@ class IrCron(models.Model): _logger.debug("Sending scheduler error email with context=%s", context) - template = my_cron.email_template_id.with_context(context).sudo() + template = my_cron.email_template_id.with_context(**context).sudo() template.send_mail(my_cron.id, force_send=True) return res