Allow admins to inspect invoices (#5641)

This is helpful to debug invoice renderers or non-PDF invoices like
Peppol or other XML formats
This commit is contained in:
Raphael Michel
2025-11-19 14:42:18 +01:00
committed by GitHub
parent 9c80f3038a
commit db7518735a
4 changed files with 34 additions and 2 deletions

View File

@@ -20,6 +20,7 @@
# <https://www.gnu.org/licenses/>.
#
from django.core.files import File
from django_countries.fields import Country
from i18nfield.utils import I18nJSONEncoder
from phonenumber_field.phonenumber import PhoneNumber
@@ -36,7 +37,9 @@ class CustomJSONEncoder(I18nJSONEncoder):
return obj.name
elif isinstance(obj, LazyI18nStringList):
return [s.data for s in obj.data]
if isinstance(obj, PhoneNumber):
elif isinstance(obj, PhoneNumber):
return str(obj)
elif isinstance(obj, Country):
return str(obj)
else:
return super().default(obj)