[IMP] base_exception: log traceback when code exception is raised

pull/2463/head
Ivàn Todorovich 2022-05-24 14:41:16 -03:00 committed by matiasperalta1
parent e08dc1d578
commit 15f1c01227
2 changed files with 10 additions and 3 deletions

View File

@ -5,7 +5,7 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Exception Rule",
"version": "14.0.2.0.0",
"version": "14.0.2.1.0",
"category": "Generic Modules",
"summary": """
This module provide an abstract model to manage customizable

View File

@ -5,12 +5,15 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
import html
import logging
from odoo import _, api, fields, models
from odoo.exceptions import UserError, ValidationError
from odoo.osv import expression
from odoo.tools.safe_eval import safe_eval
_logger = logging.getLogger(__name__)
class ExceptionRule(models.Model):
_name = "exception.rule"
@ -157,9 +160,13 @@ class BaseExceptionMethod(models.AbstractModel):
expr, space, mode="exec", nocopy=True
) # nocopy allows to return 'result'
except Exception as e:
_logger.exception(e)
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)