diff --git a/statechart/models/interpreter.py b/statechart/models/interpreter.py index e76e10c..48a44c4 100644 --- a/statechart/models/interpreter.py +++ b/statechart/models/interpreter.py @@ -7,15 +7,12 @@ from sismic.interpreter import Interpreter as SismicInterpreter from sismic.model import Event -from odoo.exceptions import except_orm - def _root_cause(e): - if isinstance(e, except_orm): - return e - if not hasattr(e, "__cause__") or not e.__cause__: - return e - return _root_cause(e.__cause__) + cause_exc = getattr(e, "__cause__", False) + if cause_exc: + return cause_exc + return e class Interpreter(SismicInterpreter):