From 537f0be734732bbbb46a955cfd47a78ca020b1fd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20NO=C3=8BL?= <tnoel@entrouvert.com>
Date: Mon, 3 Aug 2020 23:52:46 +0200
Subject: [PATCH] family: fix empty or null pay_limit_date export (#45714)

---
 passerelle/apps/family/models.py |   2 +-
 tests/data/family_data.zip       | Bin 75699 -> 77559 bytes
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/passerelle/apps/family/models.py b/passerelle/apps/family/models.py
index c8813331..4926f139 100644
--- a/passerelle/apps/family/models.py
+++ b/passerelle/apps/family/models.py
@@ -114,7 +114,7 @@ def format_invoice(i):
         'no_online_payment_reason': i.no_online_payment_reason,
         'has_pdf': i.has_pdf
     }
-    if now().date() > i.pay_limit_date:
+    if i.pay_limit_date and now().date() > i.pay_limit_date:
         invoice['online_payment'] = False
         invoice['no_online_payment_reason'] = 'past-due-date'
     return invoice
diff --git a/tests/data/family_data.zip b/tests/data/family_data.zip
index 8da93c8e2da20f3c831a348e488dc7262668db98..f1c9129b6655d40ab9748a63661c4f09ec1cfdad 100644
GIT binary patch
-- 
2.27.0

