Commit 30a7ce16 authored by Yusei Tahara's avatar Yusei Tahara

2010-05-21 yusei

* Change base amount preference. Only one preferred list on trade is enough.
* Revert previous changes. On movements, display uses defined on the corresponding resource only.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35529 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d7283d6b
...@@ -305,10 +305,8 @@ ...@@ -305,10 +305,8 @@
<string>my_view_mode_matrix_box</string> <string>my_view_mode_matrix_box</string>
<string>my_view_mode_planning_box</string> <string>my_view_mode_planning_box</string>
<string>my_report_mode_report_box</string> <string>my_report_mode_report_box</string>
<string>my_view_mode_preferred_sale_base_amount_list</string> <string>my_view_mode_preferred_trade_base_amount_list</string>
<string>my_view_mode_preferred_purchase_base_amount_list</string> <string>my_view_mode_movement_use</string>
<string>my_view_mode_packing_use</string>
<string>my_view_mode_order_use</string>
</list> </list>
</value> </value>
</item> </item>
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>my_view_mode_order_use</string> </value> <value> <string>my_view_mode_movement_use</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python:here.OrderLine_getPreferredCategoryItemList(category_id=\'use\')</string> </value> <value> <string>here/Movement_getUseItemList</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>items</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_view_mode_packing_use</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_view_mode_use</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewTradeFieldLibrary</string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python:here.Base_getPreferredCategoryItemList(mode=\'packing\', category_id=\'use\')</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>items</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_view_mode_preferred_purchase_base_amount_list</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_multi_list_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Purchase Base Amounts</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: getattr(here.portal_categories.base_amount, preferences.getPreference(\'preferred_category_child_item_list_method_id\', \'getCategoryChildCompactLogicalPathItemList\'))(base=1, local_sort_id=(\'int_index\', \'translated_title\'), checked_permission=\'View\')</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>my_view_mode_preferred_sale_base_amount_list</string> </value> <value> <string>my_view_mode_preferred_trade_base_amount_list</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
...@@ -105,7 +105,7 @@ ...@@ -105,7 +105,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Sale Base Amounts</string> </value> <value> <string>Base Amounts</string> </value>
</item> </item>
</dictionary> </dictionary>
</value> </value>
......
...@@ -58,23 +58,17 @@ ...@@ -58,23 +58,17 @@
portal_categories = context.portal_categories\n portal_categories = context.portal_categories\n
portal_preferences = context.portal_preferences\n portal_preferences = context.portal_preferences\n
method_id = portal_preferences.getPreference(\'preferred_category_child_item_list_method_id\', \'getCategoryChildCompactLogicalPathItemList\')\n method_id = portal_preferences.getPreference(\'preferred_category_child_item_list_method_id\', \'getCategoryChildCompactLogicalPathItemList\')\n
category = getattr(portal_categories, category_id)\n
\n \n
item_list = getattr(category, method_id)(local_sort_id=(\'int_index\', \'translated_title\'), checked_permission=\'View\')\n item_list = getattr(portal_categories.use, method_id)(local_sort_id=(\'int_index\', \'translated_title\'), checked_permission=\'View\')\n
\n \n
if not mode:\n resource = context.getResourceValue()\n
return item_list\n if resource is None:\n
item_display_list = ()\n
else:\n
selected_use_list = [use_value.getCategoryRelativeUrl() for use_value in resource.getUseValueList()]\n
item_display_list = [item for item in item_list if item[1] in selected_use_list]\n
\n \n
preferred_list_method_id = \'get%s\' % (UpperCase(\'preferred_%s_%s_list\' % (mode, category_id)))\n return item_display_list\n
preferred_category_relative_url_list = [portal_categories.getCategoryValue(relative_url).getCategoryRelativeUrl()\n
for relative_url in getattr(portal_preferences, preferred_list_method_id)()]\n
\n
if not preferred_category_relative_url_list:\n
return item_list\n
\n
# XXX result should be cached.\n
return [item for item in item_list\n
if (item[1]==\'\' or item[1] in preferred_category_relative_url_list)]\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -85,7 +79,7 @@ return [item for item in item_list\n ...@@ -85,7 +79,7 @@ return [item for item in item_list\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>category_id, mode=None</string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -105,14 +99,12 @@ return [item for item in item_list\n ...@@ -105,14 +99,12 @@ return [item for item in item_list\n
<dictionary> <dictionary>
<item> <item>
<key> <string>co_argcount</string> </key> <key> <string>co_argcount</string> </key>
<value> <int>2</int> </value> <value> <int>0</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
<value> <value>
<tuple> <tuple>
<string>category_id</string>
<string>mode</string>
<string>Products.ERP5Type.Utils</string> <string>Products.ERP5Type.Utils</string>
<string>UpperCase</string> <string>UpperCase</string>
<string>_getattr_</string> <string>_getattr_</string>
...@@ -121,14 +113,15 @@ return [item for item in item_list\n ...@@ -121,14 +113,15 @@ return [item for item in item_list\n
<string>portal_preferences</string> <string>portal_preferences</string>
<string>method_id</string> <string>method_id</string>
<string>getattr</string> <string>getattr</string>
<string>category</string>
<string>item_list</string> <string>item_list</string>
<string>preferred_list_method_id</string> <string>resource</string>
<string>None</string>
<string>item_display_list</string>
<string>append</string> <string>append</string>
<string>$append0</string> <string>$append0</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>relative_url</string> <string>use_value</string>
<string>preferred_category_relative_url_list</string> <string>selected_use_list</string>
<string>item</string> <string>item</string>
<string>_getitem_</string> <string>_getitem_</string>
</tuple> </tuple>
...@@ -142,14 +135,12 @@ return [item for item in item_list\n ...@@ -142,14 +135,12 @@ return [item for item in item_list\n
<item> <item>
<key> <string>func_defaults</string> </key> <key> <string>func_defaults</string> </key>
<value> <value>
<tuple> <none/>
<none/>
</tuple>
</value> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Base_getPreferredCategoryItemList</string> </value> <value> <string>Movement_getUseItemList</string> </value>
</item> </item>
<item> <item>
<key> <string>warnings</string> </key> <key> <string>warnings</string> </key>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>mode = None\n
#WAAA Using portal_type is not good\n
if context.portal_type.startswith(\'Sale\'):\n
mode = \'sale\'\n
elif context.portal_type.startswith(\'Purchase\'):\n
mode = \'purchase\'\n
return context.Base_getPreferredCategoryItemList(mode=mode, category_id=category_id)\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>category_id</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>category_id</string>
<string>None</string>
<string>mode</string>
<string>_getattr_</string>
<string>context</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>OrderLine_getPreferredCategoryItemList</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>field_id</string> </key> <key> <string>field_id</string> </key>
<value> <string>my_view_mode_order_use</string> </value> <value> <string>my_view_mode_movement_use</string> </value>
</item> </item>
<item> <item>
<key> <string>form_id</string> </key> <key> <string>form_id</string> </key>
......
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>field_id</string> </key> <key> <string>field_id</string> </key>
<value> <string>my_view_mode_packing_use</string> </value> <value> <string>my_view_mode_movement_use</string> </value>
</item> </item>
<item> <item>
<key> <string>form_id</string> </key> <key> <string>form_id</string> </key>
......
...@@ -98,8 +98,7 @@ ...@@ -98,8 +98,7 @@
<list> <list>
<string>my_preferred_supplier_role_list</string> <string>my_preferred_supplier_role_list</string>
<string>my_preferred_client_role_list</string> <string>my_preferred_client_role_list</string>
<string>my_preferred_sale_base_amount_list</string> <string>my_preferred_trade_base_amount_list</string>
<string>my_preferred_purchase_base_amount_list</string>
</list> </list>
</value> </value>
</item> </item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>my_preferred_purchase_base_amount_list</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_view_mode_preferred_purchase_base_amount_list</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewTradeFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>my_preferred_sale_base_amount_list</string> </value> <value> <string>my_preferred_trade_base_amount_list</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>field_id</string> </key> <key> <string>field_id</string> </key>
<value> <string>my_view_mode_preferred_sale_base_amount_list</string> </value> <value> <string>my_view_mode_preferred_trade_base_amount_list</string> </value>
</item> </item>
<item> <item>
<key> <string>form_id</string> </key> <key> <string>form_id</string> </key>
......
2010-05-21 yusei
* Change base amount preference. Only one preferred list on trade is enough.
* Revert previous changes. On movements, display uses defined on the corresponding resource only.
2010-05-21 yusei 2010-05-21 yusei
* Display preferred uses if preference is set. * Display preferred uses if preference is set.
......
934 940
\ No newline at end of file \ No newline at end of file
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