From 3c785ebb1eca5e384001d9e45014fd68ae5a510d Mon Sep 17 00:00:00 2001
From: Kazuhiko Shiozaki <kazuhiko@nexedi.com>
Date: Thu, 1 Jul 2010 21:56:47 +0000
Subject: [PATCH] If delivery is not simulated (PackingList.isDivergent()
 returns True in such a case), we cannot solve divergence anyway. This change
 should fix recent (random) failures of testImmobilisation.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@36787 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Document/Delivery.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/product/ERP5/Document/Delivery.py b/product/ERP5/Document/Delivery.py
index e72aa7460c..c97be1795a 100644
--- a/product/ERP5/Document/Delivery.py
+++ b/product/ERP5/Document/Delivery.py
@@ -380,7 +380,10 @@ class Delivery(XMLObject, ImmobilisationDelivery, CompositionMixin):
       if isTransitionPossible(self, 'diverge') and \
           isTransitionPossible(self, 'converge'):
         if self.isDivergent(**kw):
-          if solve_automatically and \
+          # If delivery is not simulated (PackingList.isDivergent()
+          # returns True in such a case), we cannot solve divergence
+          # anyway.
+          if self.isSimulated() and solve_automatically and \
               isTransitionPossible(self, 'solve_automatically'):
             self.solveAutomatically()
           else:
-- 
2.30.9