From ccc21a3fd6037ebb79d885b8d20a957a8f27030e Mon Sep 17 00:00:00 2001 From: Alessandro Pecchini Date: Mon, 22 Jun 2026 17:27:25 +0200 Subject: [PATCH] [IMP] api_log_mail: add default mail template for exceptions --- api_log_mail/__manifest__.py | 1 + api_log_mail/data/mail_template.xml | 47 +++++++++++++++++++++++ api_log_mail/models/api_log_collection.py | 3 ++ 3 files changed, 51 insertions(+) create mode 100644 api_log_mail/data/mail_template.xml diff --git a/api_log_mail/__manifest__.py b/api_log_mail/__manifest__.py index d334b7f9c..7bffe3b3d 100644 --- a/api_log_mail/__manifest__.py +++ b/api_log_mail/__manifest__.py @@ -16,4 +16,5 @@ "api_log", "mail", ], + "data": ["data/mail_template.xml"], } diff --git a/api_log_mail/data/mail_template.xml b/api_log_mail/data/mail_template.xml new file mode 100644 index 000000000..eef55a2ed --- /dev/null +++ b/api_log_mail/data/mail_template.xml @@ -0,0 +1,47 @@ + + + + + FastAPI: Error + + {{object.collection_ref.user_id.email or object.env.ref('base.partner_root').email}} + {{object.collection_ref.company_id.scheduler_error_email_address}} + Odoo FastAPI Error + + +
+ + + + + + + +

Error in FastAPI call

+

FastAPI endpoint:

+

Request: []

+

+ Headers: +

    +
  • + : +
  • +
+

+

+ Exception: +

+

+ Stack trace:

+                

+
+
+
+
diff --git a/api_log_mail/models/api_log_collection.py b/api_log_mail/models/api_log_collection.py index cf7a87336..7d79cd93b 100644 --- a/api_log_mail/models/api_log_collection.py +++ b/api_log_mail/models/api_log_collection.py @@ -12,6 +12,9 @@ class APILogCollection(models.AbstractModel): domain=[("model_id.model", "=", "api.log")], string="Error E-mail Template", help="An email based on this template will be sent when an error is logged.", + default=lambda self: self.env.ref( + "api_log_mail.email_template_fastapi_error", False + ), ) api_log_mail_exception_activity_type_id = fields.Many2one( comodel_name="mail.activity.type",