Is there a way to hide odoo error traceback for security reason ?
Note : using Odoo 15
You can extend the ErrorDialogBody
template to show those details for admin users
Example:
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-inherit="web.ErrorDialogBody" t-inherit-mode="extension" owl="1">
<xpath expr="//div/div" position="attributes">
<attribute name="t-if">isAdmin</attribute>
</xpath>
<xpath expr="//div[hasclass('alert-warning')]/p[2]" position="attributes">
<attribute name="t-if">isAdmin</attribute>
</xpath>
<xpath expr="//div[hasclass('alert-warning')]/p[2]" position="after">
<p t-if="!isAdmin">Please contact the administrator.</p>
</xpath>
<xpath expr="//button[hasclass('btn-link')]" position="attributes">
<attribute name="t-if">isAdmin</attribute>
</xpath>
</t>
</templates>
You need to patch the ErrorDialog
to define the isAdmin
variable
/** @odoo-module */
import { ErrorDialog } from "@web/core/errors/error_dialogs";
import { useService } from "@web/core/utils/hooks";
import { patch } from "@web/core/utils/patch";
patch(ErrorDialog.prototype, "ErrorDialog patch", {
setup() {
this._super(...arguments);
this.isAdmin = useService("user").isAdmin;
}
});