[Erp5-report] r25248 - /erp5/trunk/products/ERP5/Document/Delivery.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Jan 22 10:27:44 CET 2009


Author: jerome
Date: Thu Jan 22 10:27:42 2009
New Revision: 25248

URL: http://svn.erp5.org?rev=25248&view=rev
Log:
if the delivery is not in a corresponding state to update applied rule, no need
to check if there's an applicable rule (just move the state test before
checking the rule existence)

Modified:
    erp5/trunk/products/ERP5/Document/Delivery.py

Modified: erp5/trunk/products/ERP5/Document/Delivery.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/Delivery.py?rev=25248&r1=25247&r2=25248&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Delivery.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/Delivery.py [utf8] Thu Jan 22 10:27:42 2009
@@ -680,6 +680,12 @@
 
       if rule_reference is None:
         return
+
+      # only expand if we are not in a "too early" or "too late" state
+      if (self.getSimulationState() in
+          self.getPortalDraftOrderStateList()):
+        return
+
       portal_rules = getToolByName(self, 'portal_rules')
       res = portal_rules.searchFolder(reference=rule_reference,
           validation_state="validated", sort_on='version',
@@ -690,10 +696,7 @@
       else:
         raise NotFound('No such rule as %r is found' % (rule_reference,))
 
-      # only expand if we are not in a "too early" or "too late" state
-      if (self.getSimulationState() not in
-          self.getPortalDraftOrderStateList()):
-        self._createAppliedRule(rule_id, force=force, **kw)
+      self._createAppliedRule(rule_id, force=force, **kw)
 
     def _createAppliedRule(self, rule_id, force=0, activate_kw=None, **kw):
       """




More information about the Erp5-report mailing list