From b689ddba7a212c5d325d3e3fefe2290b98997cd3 Mon Sep 17 00:00:00 2001
From: Jean-Paul Smets <jp@nexedi.com>
Date: Fri, 23 Jan 2004 19:00:13 +0000
Subject: [PATCH] Only reexpand if silulation_state is compatible

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

diff --git a/product/ERP5/Document/Order.py b/product/ERP5/Document/Order.py
index cc0b60451d..99c5cebc7d 100755
--- a/product/ERP5/Document/Order.py
+++ b/product/ERP5/Document/Order.py
@@ -118,8 +118,9 @@ An order..."""
     security.declarePrivate( '_edit' )
     def _edit(self, REQUEST=None, force_update = 0, **kw):
       Delivery._edit(self, REQUEST=REQUEST, force_update = force_update, **kw)
-      # We must expand our applied rule
-      self.updateAppliedRule() # This should be implemented with the interaction tool rather than with this hard coding
+      # We must expand our applied rule only if not confirmed
+      if self.getSimulationState() in planned_order_state:
+        self.updateAppliedRule() # This should be implemented with the interaction tool rather than with this hard coding
 
     def updateAppliedRule(self):
       if self.getSimulationState() not in draft_order_state:
@@ -284,6 +285,6 @@ An order..."""
           Delete related Applied Rule
       """
       for o in self.getCausalityRelatedValueList(portal_type='Applied Rule'):
-        o.aq_parent.deleteContent(o.getId())
+        o.aq_parent.activate().deleteContent(o.getId())
       Delivery.manage_beforeDelete(self, item, container)
 
-- 
2.30.9