23 lines
689 B
Python
23 lines
689 B
Python
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
|