debug: add monkey-patch to UserError to trace expense report locking errors and remove unused controllers import
This commit is contained in:
parent
12c4edb221
commit
4778cd3841
22
__init__.py
22
__init__.py
@ -1,2 +1,22 @@
|
|||||||
|
import logging
|
||||||
|
import traceback
|
||||||
|
from odoo.exceptions import UserError
|
||||||
|
|
||||||
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
# Diagnostic monkey-patch to find where the UserError is coming from
|
||||||
|
original_init = UserError.__init__
|
||||||
|
|
||||||
|
def diagnostic_init(self, *args, **kwargs):
|
||||||
|
message = args[0] if args else ""
|
||||||
|
if "linked to an expense report" in str(message):
|
||||||
|
with open("/tmp/odoo_lock_traceback.txt", "w") as f:
|
||||||
|
f.write("LOCKED ERROR CAUGHT!\n")
|
||||||
|
f.write(f"Message: {message}\n")
|
||||||
|
f.write("TRACEBACK:\n")
|
||||||
|
traceback.print_stack(file=f)
|
||||||
|
return original_init(self, *args, **kwargs)
|
||||||
|
|
||||||
|
UserError.__init__ = diagnostic_init
|
||||||
|
|
||||||
from . import models
|
from . import models
|
||||||
from . import controllers
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user