fix: QwebJSON circular reference on non-serializable session_info values

The QwebJSON.dumps default handler returned non-serializable objects
unchanged, causing Python's json encoder to report "Circular reference
detected". Use odoo.tools.json.json_default() as fallback to properly
convert ReadonlyDict, lazy, datetime, bytes, Domain and other types.

🤖 assisted by claude
This commit is contained in:
Ernad Husremovic 2026-03-10 13:56:35 +01:00
parent 6d349fb9e9
commit 2374290414
2 changed files with 74 additions and 1 deletions

View file

@ -656,7 +656,7 @@ class QwebJSON(json.JSON):
def dumps(self, *args, **kwargs):
prev_default = kwargs.pop('default', lambda obj: obj)
return super().dumps(*args, **kwargs, default=(
lambda obj: prev_default(str(obj) if isinstance(obj, QwebContent) else obj)
lambda obj: prev_default(str(obj) if isinstance(obj, QwebContent) else json.json_default(obj))
))