Commit c2e57d60 authored by Nicolas Dumazet's avatar Nicolas Dumazet

and now we can remove one level of indentation and make it more readable


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35977 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent fd68f6a4
...@@ -143,26 +143,25 @@ class SupplyChain(Path, XMLObject): ...@@ -143,26 +143,25 @@ class SupplyChain(Path, XMLObject):
if current_supply_link is None: if current_supply_link is None:
# No current_supply_link defined, we need to return the last SupplyLink # No current_supply_link defined, we need to return the last SupplyLink
return [self.getLastLink()] 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 = [] # Get all SupplyLink in the SupplyChain
previous_production_list = [] supply_link_list = self.objectValues(
for supply_link in supply_link_list: portal_type=self.supply_link_portal_type)
if supply_link != current_supply_link and \ # Destination of valid link must be the source of the current link.
supply_link.getNextNodeValue() == current_node_value: current_node_value = current_supply_link.getCurrentNodeValue()
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_supply_link_list = previous_production_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)
return previous_supply_link_list if previous_production_list != []:
return previous_production_list
return previous_supply_link_list
security.declareProtected(Permissions.View, security.declareProtected(Permissions.View,
'getPreviousProductionSupplyLinkList') 'getPreviousProductionSupplyLinkList')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment