From 834d4502c221f2c1e3a44ae62af8b611afa29bd2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=81ukasz=20Nowak?= <luke@nexedi.com>
Date: Fri, 9 Mar 2012 14:43:13 +0100
Subject: [PATCH] Require both dates correctly set to expand.

---
 product/ERP5/Document/SubscriptionItem.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/product/ERP5/Document/SubscriptionItem.py b/product/ERP5/Document/SubscriptionItem.py
index f84364cc70..fccd4a7806 100644
--- a/product/ERP5/Document/SubscriptionItem.py
+++ b/product/ERP5/Document/SubscriptionItem.py
@@ -281,6 +281,9 @@ class SubscriptionItem(Item, CompositionMixin, MovementGeneratorMixin, Periodici
         resource = movement.getResource()
         start_date = movement.getStartDate()
         stop_date = movement.getStopDate()
+        if start_date is None or stop_date is None or start_date>stop_date:
+          # infinity nor time back machine does not exist
+          continue
         source = movement.getSource()
         source_section = movement.getSourceSection()
         source_decision = movement.getSourceDecision()
-- 
2.30.9