-
-
Notifications
You must be signed in to change notification settings - Fork 380
[17.0][IMP] api_log_mail: add default mail template for exceptions #627
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
base: 17.0
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,4 +16,5 @@ | |
| "api_log", | ||
| "mail", | ||
| ], | ||
| "data": ["data/mail_template.xml"], | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| <?xml version="1.0" encoding="UTF-8" ?> | ||
| <!-- | ||
| ~ Copyright 2025 Simone Rubino - PyTech | ||
| ~ License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
| --> | ||
| <odoo noupdate="1"> | ||
| <record id="email_template_fastapi_error" model="mail.template"> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. chore: Please inform the user in readme/CONFIGURE.md that this template exists and should be properly configured/customized. |
||
| <field name="name">FastAPI: Error</field> | ||
| <field name="model_id" ref="api_log.model_api_log" /> | ||
| <field | ||
| name="email_from" | ||
| >{{object.collection_ref.user_id.email or object.env.ref('base.partner_root').email}}</field> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue: The field |
||
| <field | ||
| name="email_to" | ||
| >{{object.collection_ref.company_id.scheduler_error_email_address}}</field> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue: The field It would be a nice addition to the module, or you can just pick the email of the admin user. After you fix it, remember to add a test so that there won't be a regression in the future, as suggested in:
(from https://github.com/OCA/odoo-community.org/blob/master/website/Contribution/CONTRIBUTING.rst#6tests) |
||
| <field name="subject">Odoo FastAPI Error</field> | ||
| <field name="auto_delete" eval="False" /> | ||
| <field name="body_html" type="html"> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| <div> | ||
| <t t-set="endpoint_name" t-value="object.collection_ref.name" /> | ||
| <t t-set="request_url" t-value="object.request_url" /> | ||
| <t t-set="request_method" t-value="object.request_method" /> | ||
| <t t-set="headers" t-value="object.request_headers" /> | ||
| <t t-set="exception" t-value="object.response_body" /> | ||
| <t t-set="exception_stack" t-value="object.stack_trace" /> | ||
|
|
||
| <p>Error in FastAPI call</p> | ||
| <p>FastAPI endpoint: <t t-out="endpoint_name" /></p> | ||
| <p>Request: [<t t-out="request_method" />] <t t-out="request_url" /></p> | ||
| <p> | ||
| Headers: | ||
| <ul> | ||
| <li t-foreach="headers.items()" t-as="hd"> | ||
| <t t-out="hd[0]" />: <t t-out="hd[1]" /> | ||
| </li> | ||
| </ul> | ||
| </p> | ||
| <p> | ||
| Exception: <t t-out="exception" /> | ||
| </p> | ||
| <p> | ||
| Stack trace: <pre t-out="exception_stack" /> | ||
| </p> | ||
| </div> | ||
| </field> | ||
| </record> | ||
| </odoo> | ||

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion:
api_log_mailis a generic module so it should not mentionfastapi.Please either remove the
fastapimentions, or move this to thefastapi_log_mailmodule.Note that the migration from
16.0should work as expected: for instance, if you rename the XMLID you should call https://oca.github.io/openupgradelib/API.html#openupgradelib.openupgrade.rename_xmlids.