Commit eac507cf authored by Jean-Paul Smets's avatar Jean-Paul Smets

Added more stock navigation features (explanations)


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@43 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6aa0c9b5
...@@ -155,12 +155,37 @@ class InventoryListBrain(ZSQLBrain): ...@@ -155,12 +155,37 @@ class InventoryListBrain(ZSQLBrain):
def getListItemUrl(self, cname_id, selection_index, selection_name): def getListItemUrl(self, cname_id, selection_index, selection_name):
try: try:
if cname_id in ('getExplanationText','getExplanation', ):
o = self.getObject()
if o is not None:
return o.getExplanation()
else:
return ''
else:
resource = self.portal_categories.unrestrictedTraverse(self.resource_relative_url) resource = self.portal_categories.unrestrictedTraverse(self.resource_relative_url)
return '%s/Resource_movementHistoryView?%s' % (resource.absolute_url(), return '%s/Resource_movementHistoryView?%s' % (resource.absolute_url(),
make_query(variation_text=self.variation_text, selection_name=selection_name, selection_index=selection_index)) make_query(variation_text=self.variation_text, selection_name=selection_name, selection_index=selection_index))
except: except:
return '' return ''
def getExplanationText(self):
# Returns an explanation of the movement
o = self.getObject()
if o is not None:
portal_type = o.getPortalType()
if portal_type == "Simulation Movement":
ra = o.getRootAppliedRule()
order = o.getCausalityValue()
if order is not None:
return "Simulated Order %s" % (order.getId())
else:
LOG("Delivery Value",0,str(self.path))
delivery = o.getExplanationValue()
LOG("Delivery Value",0,str(delivery))
if delivery is not None:
return "%s %s" % (delivery.getPortalType(), delivery.getId())
return "Unknown"
class DeliveryListBrain(InventoryListBrain): class DeliveryListBrain(InventoryListBrain):
""" """
Lists each variation Lists each variation
......
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