From c3350bb9bcf5249d18a49c5a3924aacef732648a Mon Sep 17 00:00:00 2001 From: mpeltriaux Date: Thu, 1 Dec 2022 15:35:45 +0100 Subject: [PATCH] EGON GML Payment date * fixes bug where missing payment date would result in no egon message sent --- intervention/utils/egon_export.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/intervention/utils/egon_export.py b/intervention/utils/egon_export.py index 0b979a1..db17557 100644 --- a/intervention/utils/egon_export.py +++ b/intervention/utils/egon_export.py @@ -67,6 +67,7 @@ class EgonGmlBuilder: """ intervention = None gml = None + _PAYMENT_FALLBACK_DATE = "" def __init__(self, intervention): self.intervention = intervention @@ -164,7 +165,10 @@ class EgonGmlBuilder: payment_date = None if payment is not None: payment_date = payment.due_on - payment_date = payment_date.strftime(DEFAULT_DATE_FORMAT) + if payment_date is not None: + payment_date = payment_date.strftime(DEFAULT_DATE_FORMAT) + else: + payment_date = self._PAYMENT_FALLBACK_DATE cons_office = self.intervention.responsible.conservation_office reg_office = self.intervention.responsible.registration_office -- 2.38.5