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
...@@ -160,10 +160,18 @@ ...@@ -160,10 +160,18 @@
<key> <string>alternate_name</string> </key> <key> <string>alternate_name</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>anchor</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>columns</string> </key> <key> <string>columns</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>count_method</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>css_class</string> </key> <key> <string>css_class</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
...@@ -172,6 +180,10 @@ ...@@ -172,6 +180,10 @@
<key> <string>default</string> </key> <key> <string>default</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>default_display_style</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>default_params</string> </key> <key> <string>default_params</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
...@@ -180,6 +192,10 @@ ...@@ -180,6 +192,10 @@
<key> <string>description</string> </key> <key> <string>description</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>display_style_list</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>domain_root_list</string> </key> <key> <string>domain_root_list</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
...@@ -188,10 +204,18 @@ ...@@ -188,10 +204,18 @@
<key> <string>domain_tree</string> </key> <key> <string>domain_tree</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>editable_columns</string> </key> <key> <string>editable_columns</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>external_validator</string> </key> <key> <string>external_validator</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
...@@ -200,10 +224,18 @@ ...@@ -200,10 +224,18 @@
<key> <string>global_attributes</string> </key> <key> <string>global_attributes</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>global_search_column</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>hidden</string> </key> <key> <string>hidden</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>hide_rows_on_no_search_criterion</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>lines</string> </key> <key> <string>lines</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
...@@ -220,6 +252,14 @@ ...@@ -220,6 +252,14 @@
<key> <string>meta_types</string> </key> <key> <string>meta_types</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>page_navigation_template</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>page_template</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>portal_types</string> </key> <key> <string>portal_types</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
...@@ -232,6 +272,10 @@ ...@@ -232,6 +272,10 @@
<key> <string>report_tree</string> </key> <key> <string>report_tree</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>row_css_method</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>search</string> </key> <key> <string>search</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
...@@ -256,14 +300,36 @@ ...@@ -256,14 +300,36 @@
<key> <string>sort_columns</string> </key> <key> <string>sort_columns</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>stat_columns</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>stat_method</string> </key> <key> <string>stat_method</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>style_columns</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>untranslatable_columns</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>url_columns</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>url_parameter_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary> </dictionary>
</value> </value>
</item> </item>
...@@ -338,6 +404,10 @@ ...@@ -338,6 +404,10 @@
<key> <string>default</string> </key> <key> <string>default</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>default_display_style</string> </key>
<value> <string>table</string> </value>
</item>
<item> <item>
<key> <string>default_params</string> </key> <key> <string>default_params</string> </key>
<value> <value>
...@@ -348,6 +418,12 @@ ...@@ -348,6 +418,12 @@
<key> <string>description</string> </key> <key> <string>description</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>display_style_list</string> </key>
<value>
<list/>
</value>
</item>
<item> <item>
<key> <string>domain_root_list</string> </key> <key> <string>domain_root_list</string> </key>
<value> <value>
...@@ -404,10 +480,18 @@ ...@@ -404,10 +480,18 @@
<list/> <list/>
</value> </value>
</item> </item>
<item>
<key> <string>global_search_column</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>hidden</string> </key> <key> <string>hidden</string> </key>
<value> <int>0</int> </value> <value> <int>0</int> </value>
</item> </item>
<item>
<key> <string>hide_rows_on_no_search_criterion</string> </key>
<value> <int>0</int> </value>
</item>
<item> <item>
<key> <string>lines</string> </key> <key> <string>lines</string> </key>
<value> <int>20</int> </value> <value> <int>20</int> </value>
...@@ -419,7 +503,7 @@ ...@@ -419,7 +503,7 @@
<item> <item>
<key> <string>list_method</string> </key> <key> <string>list_method</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
<item> <item>
...@@ -428,6 +512,10 @@ ...@@ -428,6 +512,10 @@
<list/> <list/>
</value> </value>
</item> </item>
<item>
<key> <string>page_navigation_template</string> </key>
<value> <string>ListBox_viewSliderPageNavigationRenderer</string> </value>
</item>
<item> <item>
<key> <string>page_template</string> </key> <key> <string>page_template</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
...@@ -448,6 +536,10 @@ ...@@ -448,6 +536,10 @@
<key> <string>report_tree</string> </key> <key> <string>report_tree</string> </key>
<value> <int>0</int> </value> <value> <int>0</int> </value>
</item> </item>
<item>
<key> <string>row_css_method</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>search</string> </key> <key> <string>search</string> </key>
<value> <int>0</int> </value> <value> <int>0</int> </value>
...@@ -472,7 +564,7 @@ ...@@ -472,7 +564,7 @@
<list> <list>
<tuple> <tuple>
<string>date</string> <string>date</string>
<string>Date</string> <string>asc</string>
</tuple> </tuple>
</list> </list>
</value> </value>
...@@ -492,7 +584,13 @@ ...@@ -492,7 +584,13 @@
<item> <item>
<key> <string>stat_method</string> </key> <key> <string>stat_method</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>style_columns</string> </key>
<value>
<list/>
</value> </value>
</item> </item>
<item> <item>
...@@ -511,6 +609,12 @@ ...@@ -511,6 +609,12 @@
<list/> <list/>
</value> </value>
</item> </item>
<item>
<key> <string>url_parameter_dict</string> </key>
<value>
<list/>
</value>
</item>
</dictionary> </dictionary>
</value> </value>
</item> </item>
...@@ -518,6 +622,19 @@ ...@@ -518,6 +622,19 @@
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: {\'date\': {}, \'getExplanationText\': {}, \'node_title\':{}, \'section_title\':{}, \'variation_category_item_list\': {},\'total_quantity\':{}, \'getTranslatedSimulationStateTitle\':{}}</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle> <pickle>
<global name="Method" module="Products.Formulator.MethodField"/> <global name="Method" module="Products.Formulator.MethodField"/>
</pickle> </pickle>
...@@ -530,7 +647,7 @@ ...@@ -530,7 +647,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="Method" module="Products.Formulator.MethodField"/> <global name="Method" module="Products.Formulator.MethodField"/>
</pickle> </pickle>
......
...@@ -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,20 +2344,24 @@ class ListBoxHTMLRendererLine(ListBoxRendererLine): ...@@ -2344,20 +2344,24 @@ 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 = ''
else: if getattr(brain, 'getListItem', None) is not None:
try: item = brain.getListItem(alias, self.index, selection_name)
url = self.getObject().getPortalObject().restrictedTraverse(result_dict['jio_key']).absolute_url() if item is not None:
except KeyError: url = item.absolute_url()
url = result_dict['jio_key'] else:
try:
if 'view_action' in result_dict: url = self.getObject().getPortalObject().restrictedTraverse(result_dict['jio_key']).absolute_url()
url += result_dict['view_action'] except KeyError:
if 'parameter' not in result_dict and getattr(brain, 'getListItemParamDict', None) is not None: url = result_dict['jio_key']
result_dict['parameter'] = brain.getListItemParamDict(alias, self.index, selection_name)
if 'parameter' in result_dict: if 'view_action' in result_dict:
url += result_dict['view_action']
if 'parameter' not in result_dict and getattr(brain, 'getListItemParamDict', None) is not None:
result_dict['parameter'] = brain.getListItemParamDict(alias, self.index, selection_name)
if 'parameter' in result_dict:
url = '%s?%s' % (url, make_query(result_dict['parameter'])) url = '%s?%s' % (url, make_query(result_dict['parameter']))
# Find an URL method. # Find an URL method.
......
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