From e8195b944682e189bf2c97178f64f0d405285f15 Mon Sep 17 00:00:00 2001
From: Sebastien Robin <seb@nexedi.com>
Date: Tue, 26 Apr 2005 07:26:04 +0000
Subject: [PATCH] we must not assume that we always have the getSimulationState
 method

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@2949 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Document/OrderLine.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/product/ERP5/Document/OrderLine.py b/product/ERP5/Document/OrderLine.py
index 187572bfc3..068e2755e7 100755
--- a/product/ERP5/Document/OrderLine.py
+++ b/product/ERP5/Document/OrderLine.py
@@ -107,9 +107,11 @@ class OrderLine(DeliveryLine):
           (Called when the object is created or moved.)
       """
       DeliveryLine.manage_afterAdd(self, item, container)
-      if self.aq_parent.getSimulationState() not in self.getPortalDraftOrderStateList():
-        # Only reexpand order rule when we add lines
-        self.aq_parent.activate()._createOrderRule()
+      # Make sure we have a workflow with the variable name 'simulation_state'
+      if getattr(self.getParent(),'getSimulationState'):
+        if self.getParent().getSimulationState() not in self.getPortalDraftOrderStateList():
+          # Only reexpand order rule when we add lines
+          self.aq_parent.activate()._createOrderRule()
 
     # Simulation Consistency Check
     def getSimulationQuantity(self):
-- 
2.30.9