[IMP] set default template
parent
5f990650fe
commit
d397442a71
|
@ -1,3 +1,4 @@
|
||||||
# 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 models
|
from . import models
|
||||||
|
from .hooks import post_init_hook
|
||||||
|
|
|
@ -16,4 +16,5 @@
|
||||||
"demo": ["demo/ir_cron_demo.xml"],
|
"demo": ["demo/ir_cron_demo.xml"],
|
||||||
"images": ["images/scheduler_error_mailer.jpg"],
|
"images": ["images/scheduler_error_mailer.jpg"],
|
||||||
"installable": True,
|
"installable": True,
|
||||||
|
"post_init_hook": "post_init_hook",
|
||||||
}
|
}
|
||||||
|
|
|
@ -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(cr, registry):
|
||||||
|
env = api.Environment(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
|
||||||
|
}
|
||||||
|
)
|
|
@ -20,6 +20,9 @@ class IrCron(models.Model):
|
||||||
string="Error E-mail Template",
|
string="Error E-mail Template",
|
||||||
help="Select the email template that will be sent when "
|
help="Select the email template that will be sent when "
|
||||||
"this scheduler fails.",
|
"this scheduler fails.",
|
||||||
|
default=lambda self: self.env.ref(
|
||||||
|
"scheduler_error_mailer.scheduler_error_mailer", False
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
|
|
Loading…
Reference in New Issue