[Erp5-report] r11837 - in /erp5/trunk/bt5/erp5_accounting: SkinTemplateItem/portal_skins/er...
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Jan 3 00:09:50 CET 2007
Author: jerome
Date: Wed Jan 3 00:09:42 2007
New Revision: 11837
URL: http://svn.erp5.org?rev=11837&view=rev
Log:
modify Account_view to be able to associate an Account on multiple accounting plans (from JPS patches)
Added:
erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_hashGapItemList.xml
erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_view/my_gap_list.xml
Removed:
erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_view/my_gap.xml
Modified:
erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_getGapItemList.xml
erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_view.xml
erp5/trunk/bt5/erp5_accounting/bt/revision
Modified: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_getGapItemList.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_getGapItemList.xml?rev=11837&r1=11836&r2=11837&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_getGapItemList.xml (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_getGapItemList.xml Wed Jan 3 00:09:42 2007
@@ -68,7 +68,14 @@
</item>
<item>
<key> <string>_body</string> </key>
- <value> <string>display_cache = {}\n
+ <value> <string>"""Return a list of possible GAP categories for a given account.\n
+\n
+if only_preferred_gap parameter is true, this will return only GAP\n
+categories from the GAP set in preferences, otherwise it will return\n
+categories from all available GAP.\n
+"""\n
+\n
+display_cache = {}\n
\n
def display(x):\n
if x not in display_cache:\n
@@ -82,20 +89,25 @@
def sort(x,y):\n
return cmp(display(x), display(y))\n
\n
-gap_root = context.portal_preferences.getPreferredAccountingTransactionGap() \n
-if gap_root is None:\n
- return [(\'Set Preferred GAP In preferences !\', \'\')]\n
+def getGapItemList(only_preferred_gap): \n
+ ctool = context.getPortalObject().portal_categories\n
+ if only_preferred_gap:\n
+ gap_root = context.getPortalObject().portal_preferences\\\n
+ .getPreferredAccountingTransactionGap() or\\\n
+ context.getPortalDefaultGapRoot()\n
+ return ctool.resolveCategory(gap_root).getCategoryChildItemList(\n
+ base=0, is_self_excluded=1, display_method=display, sort_method=sort)\n
\n
-def getGapItemList(gap_root, portal_path): \n
- obj = context.portal_categories.resolveCategory(gap_root)\n
- return obj.getCategoryChildItemList(base=0, display_method=display, sort_method=sort)\n
+ result = [] \n
+ for country in ctool.gap.contentValues():\n
+ for gap_root in country.contentValues():\n
+ result.extend(gap_root.getCategoryChildItemList(\n
+ base=0, is_self_excluded=1, display_method=display, sort_method=sort))\n
+ return result\n
\n
from Products.ERP5Type.Cache import CachingMethod\n
getGapItemList = CachingMethod(getGapItemList, id=\'Account_getGapItemList\')\n
-gap_item_list = getGapItemList(gap_root=gap_root, portal_path=context.portal_url())\n
-\n
-# Don\'t return the last item, which is the gap_root (like "fr/pcg")\n
-return gap_item_list[:-1]\n
+return getGapItemList(only_preferred_gap=only_preferred_gap)\n
</string> </value>
</item>
<item>
@@ -112,7 +124,7 @@
</item>
<item>
<key> <string>_params</string> </key>
- <value> <string></string> </value>
+ <value> <string>only_preferred_gap=1</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
@@ -132,24 +144,19 @@
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
- <value> <int>0</int> </value>
+ <value> <int>1</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
+ <string>only_preferred_gap</string>
<string>display_cache</string>
<string>display</string>
<string>sort</string>
- <string>_getattr_</string>
- <string>context</string>
- <string>gap_root</string>
- <string>None</string>
<string>getGapItemList</string>
<string>Products.ERP5Type.Cache</string>
<string>CachingMethod</string>
- <string>gap_item_list</string>
- <string>_getitem_</string>
</tuple>
</value>
</item>
@@ -161,7 +168,9 @@
<item>
<key> <string>func_defaults</string> </key>
<value>
- <none/>
+ <tuple>
+ <int>1</int>
+ </tuple>
</value>
</item>
<item>
Added: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_hashGapItemList.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_hashGapItemList.xml?rev=11837&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_hashGapItemList.xml (added)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_hashGapItemList.xml Wed Jan 3 00:09:42 2007
@@ -1,0 +1,230 @@
+<?xml version="1.0"?>
+<ZopeData>
+ <record id="1" aka="AAAAAAAAAAE=">
+ <pickle>
+ <tuple>
+ <tuple>
+ <string>Products.PythonScripts.PythonScript</string>
+ <string>PythonScript</string>
+ </tuple>
+ <none/>
+ </tuple>
+ </pickle>
+ <pickle>
+ <dictionary>
+ <item>
+ <key> <string>Python_magic</string> </key>
+ <value>
+ <none/>
+ </value>
+ </item>
+ <item>
+ <key> <string>Script_magic</string> </key>
+ <value> <int>3</int> </value>
+ </item>
+ <item>
+ <key> <string>__ac_local_roles__</string> </key>
+ <value>
+ <none/>
+ </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>N_ = context.Base_translateString\n
+split_depth = 2\n
+\n
+def getSubFieldDict():\n
+ def getSubFieldDictCache():\n
+ # Define a dictionary where we store the subfields to display.\n
+ sub_field_dict = {}\n
+ # Try to assign each item to a sub field.\n
+ for item in item_list:\n
+ # Get value of the item\n
+ item_value = item[int(not is_right_display)]\n
+ \n
+ # Hash key from item_value\n
+ item_split = item_value.split(\'/\')\n
+ item_key = \'/\'.join(item_split[:split_depth])\n
+\n
+ # Create a new subfield if necessary\n
+ if not sub_field_dict.has_key(item_key):\n
+ # Create property dict (key are field parameters)\n
+ sub_field_property_dict = default_sub_field_property_dict.copy()\n
+ sub_field_property_dict[\'key\'] = item_key\n
+ sub_field_property_dict[\'title\'] = N_("GAP - ${gap_title}", mapping=dict(\n
+ gap_title=context.portal_categories.resolveCategory(\n
+ \'gap/%s\' % item_key).getTitle()))\n
+ sub_field_property_dict[\'required\'] = 0\n
+ sub_field_property_dict[\'field_type\'] = \'ListField\'\n
+ sub_field_property_dict[\'size\'] = 1\n
+ sub_field_property_dict[\'item_list\'] = [(\'\', \'\') ]\n
+ sub_field_property_dict[\'value\'] = None\n
+ sub_field_dict[item_key] = sub_field_property_dict\n
+\n
+ sub_field_dict[item_key][\'item_list\'].append(item)\n
+ sub_field_property_dict[\'size\'] = 1\n
+ return sub_field_dict\n
+\n
+ from Products.ERP5Type.Cache import CachingMethod\n
+ getSubFieldDictCache = CachingMethod(getSubFieldDictCache,\n
+ id=\'Account_getSubFieldDict\')\n
+ # Those cached dictionnaries are later modified, we just reset the \'value\'\n
+ # key to return clean dictionnaries.\n
+ sub_field_dict = getSubFieldDictCache()\n
+ for k in sub_field_dict.keys():\n
+ sub_field_dict[k][\'value\'] = None\n
+ return sub_field_dict\n
+\n
+sub_field_dict = getSubFieldDict()\n
+# Update sub_field_dict with values\n
+for item_value in value_list:\n
+ if item_value:\n
+ # Hash key from item_value\n
+ item_split = item_value.split(\'/\')\n
+ item_key = \'/\'.join(item_split[:split_depth])\n
+ \n
+ if not sub_field_dict.has_key(item_key):\n
+ # This can only happens if an accounting plan have been uninstalled\n
+ sub_field_property_dict = default_sub_field_property_dict.copy()\n
+ sub_field_property_dict[\'key\'] = item_key\n
+ sub_field_property_dict[\'title\'] = item_key\n
+ sub_field_property_dict[\'required\'] = 0\n
+ sub_field_property_dict[\'field_type\'] = \'ListField\'\n
+ sub_field_property_dict[\'size\'] = 1\n
+ sub_field_property_dict[\'item_list\'] = [(\'\', \'\')]\n
+ sub_field_property_dict[\'value\'] = None\n
+ sub_field_dict[item_key] = sub_field_property_dict\n
+\n
+ sub_field_dict[item_key][\'value\'] = item_value\n
+\n
+# Return the list of subfield configuration.\n
+return sub_field_dict.values()\n
+</string> </value>
+ </item>
+ <item>
+ <key> <string>_code</string> </key>
+ <value>
+ <none/>
+ </value>
+ </item>
+ <item>
+ <key> <string>_filepath</string> </key>
+ <value>
+ <none/>
+ </value>
+ </item>
+ <item>
+ <key> <string>_params</string> </key>
+ <value> <string>item_list, value_list, default_sub_field_property_dict={}, is_right_display=0</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>4</int> </value>
+ </item>
+ <item>
+ <key> <string>co_varnames</string> </key>
+ <value>
+ <tuple>
+ <string>item_list</string>
+ <string>value_list</string>
+ <string>default_sub_field_property_dict</string>
+ <string>is_right_display</string>
+ <string>_getattr_</string>
+ <string>context</string>
+ <string>N_</string>
+ <string>split_depth</string>
+ <string>getSubFieldDict</string>
+ <string>sub_field_dict</string>
+ <string>_getiter_</string>
+ <string>item_value</string>
+ <string>item_split</string>
+ <string>_getitem_</string>
+ <string>item_key</string>
+ <string>sub_field_property_dict</string>
+ <string>_write_</string>
+ <string>None</string>
+ </tuple>
+ </value>
+ </item>
+ </dictionary>
+ </state>
+ </object>
+ </value>
+ </item>
+ <item>
+ <key> <string>func_defaults</string> </key>
+ <value>
+ <tuple>
+ <dictionary/>
+ <int>0</int>
+ </tuple>
+ </value>
+ </item>
+ <item>
+ <key> <string>id</string> </key>
+ <value> <string>Account_hashGapItemList</string> </value>
+ </item>
+ <item>
+ <key> <string>warnings</string> </key>
+ <value>
+ <tuple/>
+ </value>
+ </item>
+ </dictionary>
+ </pickle>
+ </record>
+</ZopeData>
Modified: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_view.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_view.xml?rev=11837&r1=11836&r2=11837&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_view.xml (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_view.xml Wed Jan 3 00:09:42 2007
@@ -92,19 +92,18 @@
<list>
<string>my_title</string>
<string>my_credit_account</string>
- <string>my_gap</string>
+ <string>my_gap_list</string>
<string>my_account_type</string>
<string>my_financial_section</string>
<string>my_destination_title_list</string>
+ <string>my_translated_validation_state_title</string>
</list>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
- <list>
- <string>my_translated_validation_state_title</string>
- </list>
+ <list/>
</value>
</item>
</dictionary>
Added: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_view/my_gap_list.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_view/my_gap_list.xml?rev=11837&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_view/my_gap_list.xml (added)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_view/my_gap_list.xml Wed Jan 3 00:09:42 2007
@@ -1,0 +1,307 @@
+<?xml version="1.0"?>
+<ZopeData>
+ <record id="1" aka="AAAAAAAAAAE=">
+ <pickle>
+ <tuple>
+ <tuple>
+ <string>Products.ERP5Form.ParallelListField</string>
+ <string>ParallelListField</string>
+ </tuple>
+ <none/>
+ </tuple>
+ </pickle>
+ <pickle>
+ <dictionary>
+ <item>
+ <key> <string>id</string> </key>
+ <value> <string>my_gap_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>
+ <item>
+ <key> <string>required_not_found</string> </key>
+ <value> <string>Input is required but no input given.</string> </value>
+ </item>
+ <item>
+ <key> <string>unknown_selection</string> </key>
+ <value> <string>You selected an item that was not in the list.</string> </value>
+ </item>
+ </dictionary>
+ </value>
+ </item>
+ <item>
+ <key> <string>overrides</string> </key>
+ <value>
+ <dictionary>
+ <item>
+ <key> <string>alternate_name</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>css_class</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>default</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>description</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>editable</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>enabled</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>external_validator</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>extra</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>extra_item</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>first_item</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>hash_script_id</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>hidden</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>items</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>required</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>size</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>title</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>unicode</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>view_separator</string> </key>
+ <value> <string></string> </value>
+ </item>
+ </dictionary>
+ </value>
+ </item>
+ <item>
+ <key> <string>tales</string> </key>
+ <value>
+ <dictionary>
+ <item>
+ <key> <string>alternate_name</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>css_class</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>default</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>description</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>editable</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>enabled</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>external_validator</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>extra</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>extra_item</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>first_item</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>hash_script_id</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>hidden</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>required</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>size</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>title</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>unicode</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>view_separator</string> </key>
+ <value> <string></string> </value>
+ </item>
+ </dictionary>
+ </value>
+ </item>
+ <item>
+ <key> <string>values</string> </key>
+ <value>
+ <dictionary>
+ <item>
+ <key> <string>alternate_name</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>css_class</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>default</string> </key>
+ <value>
+ <list/>
+ </value>
+ </item>
+ <item>
+ <key> <string>description</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>editable</string> </key>
+ <value> <int>1</int> </value>
+ </item>
+ <item>
+ <key> <string>enabled</string> </key>
+ <value> <int>1</int> </value>
+ </item>
+ <item>
+ <key> <string>external_validator</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>extra</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>extra_item</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>first_item</string> </key>
+ <value> <int>0</int> </value>
+ </item>
+ <item>
+ <key> <string>hash_script_id</string> </key>
+ <value> <string>Account_hashGapItemList</string> </value>
+ </item>
+ <item>
+ <key> <string>hidden</string> </key>
+ <value> <int>0</int> </value>
+ </item>
+ <item>
+ <key> <string>items</string> </key>
+ <value>
+ <list/>
+ </value>
+ </item>
+ <item>
+ <key> <string>required</string> </key>
+ <value> <int>0</int> </value>
+ </item>
+ <item>
+ <key> <string>size</string> </key>
+ <value> <int>5</int> </value>
+ </item>
+ <item>
+ <key> <string>title</string> </key>
+ <value> <string>GAP</string> </value>
+ </item>
+ <item>
+ <key> <string>unicode</string> </key>
+ <value> <int>0</int> </value>
+ </item>
+ <item>
+ <key> <string>view_separator</string> </key>
+ <value> <string encoding="cdata"><![CDATA[
+
+<br />
+
+]]></string> </value>
+ </item>
+ </dictionary>
+ </value>
+ </item>
+ </dictionary>
+ </pickle>
+ </record>
+ <record id="2" aka="AAAAAAAAAAI=">
+ <pickle>
+ <tuple>
+ <tuple>
+ <string>Products.Formulator.TALESField</string>
+ <string>TALESMethod</string>
+ </tuple>
+ <none/>
+ </tuple>
+ </pickle>
+ <pickle>
+ <dictionary>
+ <item>
+ <key> <string>_text</string> </key>
+ <value> <string>python: here.Account_getGapItemList(only_preferred_gap=0)</string> </value>
+ </item>
+ </dictionary>
+ </pickle>
+ </record>
+</ZopeData>
Modified: erp5/trunk/bt5/erp5_accounting/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/bt/revision?rev=11837&r1=11836&r2=11837&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/bt/revision (original)
+++ erp5/trunk/bt5/erp5_accounting/bt/revision Wed Jan 3 00:09:42 2007
@@ -1,1 +1,1 @@
-151
+152
More information about the Erp5-report
mailing list