[Erp5-report] r35977 nicolas.dumazet - /erp5/trunk/products/ERP5/Document/SupplyChain.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Jun 4 05:16:46 CEST 2010


Author: nicolas.dumazet
Date: Fri Jun  4 05:16:46 2010
New Revision: 35977

URL: http://svn.erp5.org?rev=35977&view=rev
Log:
and now we can remove one level of indentation and make it more readable

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

Modified: erp5/trunk/products/ERP5/Document/SupplyChain.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/SupplyChain.py?rev=35977&r1=35976&r2=35977&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/SupplyChain.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/SupplyChain.py [utf8] Fri Jun  4 05:16:46 2010
@@ -143,26 +143,25 @@
     if current_supply_link is None:
       # No current_supply_link defined, we need to return the last SupplyLink
       return [self.getLastLink()]
-    else:
-      # Get all SupplyLink in the SupplyChain
-      supply_link_list = self.objectValues(
-                                 portal_type=self.supply_link_portal_type)
-      # Destination of valid link must be the source of the current link.
-      current_node_value = current_supply_link.getCurrentNodeValue()
-
-      previous_supply_link_list = []
-      previous_production_list = []
-      for supply_link in supply_link_list:
-        if supply_link != current_supply_link and \
-          supply_link.getNextNodeValue() == current_node_value:
-          previous_supply_link_list.append(supply_link)
-          if supply_link.isProductionSupplyLink():
-            previous_production_list.append(supply_link)
-
-      if previous_production_list != []:
-        previous_supply_link_list = previous_production_list
-
-      return previous_supply_link_list
+
+    # Get all SupplyLink in the SupplyChain
+    supply_link_list = self.objectValues(
+                               portal_type=self.supply_link_portal_type)
+    # Destination of valid link must be the source of the current link.
+    current_node_value = current_supply_link.getCurrentNodeValue()
+
+    previous_supply_link_list = []
+    previous_production_list = []
+    for supply_link in supply_link_list:
+      if supply_link != current_supply_link and \
+        supply_link.getNextNodeValue() == current_node_value:
+        previous_supply_link_list.append(supply_link)
+        if supply_link.isProductionSupplyLink():
+          previous_production_list.append(supply_link)
+
+    if previous_production_list != []:
+      return previous_production_list
+    return previous_supply_link_list
 
   security.declareProtected(Permissions.View,
                             'getPreviousProductionSupplyLinkList')




More information about the Erp5-report mailing list