Commit fd6bcf41 authored by Jérome Perrin's avatar Jérome Perrin

remove try: except: in getListItemUrl (it was always failing with...

remove try: except: in getListItemUrl (it was always failing with getMovementHistoryList, because Resource_zGetMovementList doesnot select resource_relative_url).
Instead, if the object is a movement, make a link to the explanation of this movement.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@12934 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent edc45d88
......@@ -160,8 +160,8 @@ class InventoryListBrain(ZSQLBrain):
return ''
def getListItemUrl(self, cname_id, selection_index, selection_name):
# XXX FIXME can catch to many exceptions
try:
"""Returns the URL for column `cname_id`. Used by ListBox
"""
if cname_id in ('getExplanationText', 'getExplanation', ):
o = self.getObject()
if o is not None:
......@@ -177,7 +177,7 @@ class InventoryListBrain(ZSQLBrain):
explanation.getRelativeUrl())
else:
return ''
elif (self.resource_relative_url is not None):
elif getattr(self, 'resource_relative_url', None) is not None:
# A resource is defined, so try to display the movement list
resource = self.portal_categories.unrestrictedTraverse(
self.resource_relative_url)
......@@ -215,14 +215,19 @@ class InventoryListBrain(ZSQLBrain):
list(self.getPortalReservedInventoryStateList())
}
query_kw.update(query_kw_update)
# Return result
return '%s/%s?%s&reset=1' % (
resource.absolute_url(),
return '%s/%s?%s&reset=1' % ( resource.absolute_url(),
form_name,
make_query(**query_kw))
except (AttributeError, KeyError), e:
LOG('InventoryListBrain', PROBLEM,
'exception caught in getListItemUrl', e)
make_query(**query_kw) )
# default case, if it's a movement, return link to the explanation of this
# movement.
o = self.getObject()
if getattr(o, 'isMovement', 0):
explanation = o.getExplanationValue()
if explanation is not None:
return '%s/%s/view' % (
self.portal_url.getPortalObject().absolute_url(),
explanation.getRelativeUrl())
return ''
def getAggregateListText(self):
......
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