[IMP] base_exception: log traceback when code exception is raised
parent
e41b48ffea
commit
9c26945393
|
@ -5,7 +5,7 @@
|
||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||||
{
|
{
|
||||||
"name": "Exception Rule",
|
"name": "Exception Rule",
|
||||||
"version": "14.0.2.0.0",
|
"version": "14.0.2.1.0",
|
||||||
"category": "Generic Modules",
|
"category": "Generic Modules",
|
||||||
"summary": """
|
"summary": """
|
||||||
This module provide an abstract model to manage customizable
|
This module provide an abstract model to manage customizable
|
||||||
|
|
|
@ -5,12 +5,15 @@
|
||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
||||||
import html
|
import html
|
||||||
|
import logging
|
||||||
|
|
||||||
from odoo import _, api, fields, models
|
from odoo import _, api, fields, models
|
||||||
from odoo.exceptions import UserError, ValidationError
|
from odoo.exceptions import UserError, ValidationError
|
||||||
from odoo.osv import expression
|
from odoo.osv import expression
|
||||||
from odoo.tools.safe_eval import safe_eval
|
from odoo.tools.safe_eval import safe_eval
|
||||||
|
|
||||||
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class ExceptionRule(models.Model):
|
class ExceptionRule(models.Model):
|
||||||
_name = "exception.rule"
|
_name = "exception.rule"
|
||||||
|
@ -157,9 +160,13 @@ class BaseExceptionMethod(models.AbstractModel):
|
||||||
expr, space, mode="exec", nocopy=True
|
expr, space, mode="exec", nocopy=True
|
||||||
) # nocopy allows to return 'result'
|
) # nocopy allows to return 'result'
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
_logger.exception(e)
|
||||||
raise UserError(
|
raise UserError(
|
||||||
_("Error when evaluating the exception.rule rule:\n %s \n(%s)")
|
_(
|
||||||
% (rule.name, e)
|
"Error when evaluating the exception.rule rule:\n %s \n(%s)",
|
||||||
|
rule.name,
|
||||||
|
e,
|
||||||
|
)
|
||||||
)
|
)
|
||||||
return space.get("failed", False)
|
return space.get("failed", False)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue