Commit 0d1ee91a authored by Xiaowu Zhang's avatar Xiaowu Zhang Committed by Ayush Tiwari

[erp5_pdm]: Migrate Resource_viewMovementHistory listbox's URL columns

parent f68c139d
...@@ -343,15 +343,20 @@ class MovementHistoryListBrain(InventoryListBrain): ...@@ -343,15 +343,20 @@ class MovementHistoryListBrain(InventoryListBrain):
return self._convertDateToZone(self.date_utc) return self._convertDateToZone(self.date_utc)
date = ComputedAttribute(_date, 1) date = ComputedAttribute(_date, 1)
def getListItem(self, cname_id, selection_index, selection_name):
document = self.getObject()
if document.isMovement():
return document.getExplanationValue()
def getListItemParamDict(self, cname_id, selection_index, selection_name):
return {}
def getListItemUrl(self, cname_id, selection_index, selection_name): def getListItemUrl(self, cname_id, selection_index, selection_name):
"""Returns the URL for column `cname_id`. Used by ListBox """Returns the URL for column `cname_id`. Used by ListBox
Here we just want a link to the explanation of movement. Here we just want a link to the explanation of movement.
""" """
document = self.getObject() item = self.getListItem(cname_id, selection_index, selection_name)
if document.isMovement(): if item is not None:
explanation = document.getExplanationValue() return item.absolute_url()
if explanation is not None:
return explanation.absolute_url()
return '' return ''
def _debit(self): def _debit(self):
......
...@@ -2344,9 +2344,13 @@ class ListBoxHTMLRendererLine(ListBoxRendererLine): ...@@ -2344,9 +2344,13 @@ class ListBoxHTMLRendererLine(ListBoxRendererLine):
result_dict[key] = value(selection=selection, selection_name=selection.getName(), column_id=sql, index=self.index) result_dict[key] = value(selection=selection, selection_name=selection.getName(), column_id=sql, index=self.index)
except TypeError: except TypeError:
result_dict[key] = value() result_dict[key] = value()
if result_dict:
if 'jio_key' not in result_dict: if 'jio_key' not in result_dict:
url = '' url = ''
if getattr(brain, 'getListItem', None) is not None:
item = brain.getListItem(alias, self.index, selection_name)
if item is not None:
url = item.absolute_url()
else: else:
try: try:
url = self.getObject().getPortalObject().restrictedTraverse(result_dict['jio_key']).absolute_url() url = self.getObject().getPortalObject().restrictedTraverse(result_dict['jio_key']).absolute_url()
......
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