From c8068b8ce25a82e57f411acd16a409715725cd52 Mon Sep 17 00:00:00 2001 From: Nicolas Clerc Date: Wed, 18 Dec 2024 14:51:55 +0100 Subject: [PATCH] =?UTF-8?q?fixup!=20=E2=9C=A8(backend)=20add=20owner=20ema?= =?UTF-8?q?il=20to=20order=20export?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/joanie/core/serializers/admin.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/backend/joanie/core/serializers/admin.py b/src/backend/joanie/core/serializers/admin.py index 0e6608716..013ee22c1 100755 --- a/src/backend/joanie/core/serializers/admin.py +++ b/src/backend/joanie/core/serializers/admin.py @@ -1455,6 +1455,8 @@ def get_credit_card_expiration_date(self, instance) -> str: Return the expiration date of the credit card if available, otherwise an empty string. """ + if not instance.credit_card: + return "" month = instance.credit_card.expiration_month year = instance.credit_card.expiration_year return f"{month}/{year}" @@ -1470,7 +1472,7 @@ def get_installment_value(self, instance, index, field) -> str: if field == "due_date": return value.strftime("%d/%m/%Y %H:%M:%S") return value - except (IndexError, KeyError): + except (IndexError, KeyError, TypeError): return "" def get_installment_due_date_1(self, instance) -> str: