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

simplify code

parent 4e6d8e4b
...@@ -158,14 +158,11 @@ class InventoryListBrain(ComputedAttributeGetItemCompatibleMixin): ...@@ -158,14 +158,11 @@ class InventoryListBrain(ComputedAttributeGetItemCompatibleMixin):
# with the inventory's uid. Then they are their own explanation. # with the inventory's uid. Then they are their own explanation.
explanation = o explanation = o
if explanation is not None: if explanation is not None:
return '%s/%s' % ( return explanation.absolute_url()
self.portal_url.getPortalObject().absolute_url(), return ''
explanation.getRelativeUrl())
else:
return ''
elif resource is not None: elif resource is not None:
# A resource is defined, so try to display the movement list # A resource is defined, so try to display the movement list
form_name = 'Resource_viewMovementHistory' form_id = 'Resource_viewMovementHistory'
query_kw = { query_kw = {
'variation_text': self.variation_text, 'variation_text': self.variation_text,
'selection_name': selection_name, 'selection_name': selection_name,
...@@ -216,7 +213,7 @@ class InventoryListBrain(ComputedAttributeGetItemCompatibleMixin): ...@@ -216,7 +213,7 @@ class InventoryListBrain(ComputedAttributeGetItemCompatibleMixin):
} }
query_kw.update(query_kw_update) query_kw.update(query_kw_update)
return '%s/%s?%s&reset=1' % ( resource.absolute_url(), return '%s/%s?%s&reset=1' % ( resource.absolute_url(),
form_name, form_id,
make_query(**query_kw) ) make_query(**query_kw) )
# default case, if it's a movement, return link to the explanation of this # default case, if it's a movement, return link to the explanation of this
...@@ -225,9 +222,7 @@ class InventoryListBrain(ComputedAttributeGetItemCompatibleMixin): ...@@ -225,9 +222,7 @@ class InventoryListBrain(ComputedAttributeGetItemCompatibleMixin):
if document.isMovement(): if document.isMovement():
explanation = document.getExplanationValue() explanation = document.getExplanationValue()
if explanation is not None: if explanation is not None:
return '%s/%s' % ( return explanation.absolute_url()
self.portal_url.getPortalObject().absolute_url(),
explanation.getRelativeUrl())
return '' return ''
def getExplanationText(self): def getExplanationText(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