From a3390b4f8ad708ce4510ef8617183ef1b7b0ea2c Mon Sep 17 00:00:00 2001 From: Yusei Tahara <yusei@nexedi.com> Date: Mon, 21 Jan 2008 13:00:28 +0000 Subject: [PATCH] 2008-1-21 yusei * Section drop down list in accounting transactions should always show existing values.(bug #510) git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18801 20353a03-c40f-0410-a6d1-a30d3c3de9de --- ...nsaction_getDestinationSectionItemList.xml | 166 ++++++++++++++++++ ...ngTransaction_getSourceSectionItemList.xml | 23 ++- .../my_destination_section.xml | 2 +- bt5/erp5_accounting/bt/change_log | 3 + bt5/erp5_accounting/bt/revision | 2 +- 5 files changed, 188 insertions(+), 8 deletions(-) create mode 100644 bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_getDestinationSectionItemList.xml diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_getDestinationSectionItemList.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_getDestinationSectionItemList.xml new file mode 100644 index 0000000000..c0193b0615 --- /dev/null +++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_getDestinationSectionItemList.xml @@ -0,0 +1,166 @@ +<?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>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>section = context.portal_preferences.getPreferredSectionCategory() or\\\n + context.portal_preferences.getPreferredAccountingTransactionSectionCategory()\n +\n +section_value = None\n +result = []\n +\n +if section is not None:\n + section_value = context.portal_categories.resolveCategory(section)\n +\n +if section_value is not None:\n + result = section_value.getGroupRelatedValueList(portal_type=\'Organisation\')\n +\n +current_destination_section = context.getDestinationSectionValue()\n +\n +if current_destination_section is not None and current_destination_section not in result:\n + result.append(current_destination_section)\n +\n +return [(i.getTitle(), i.getRelativeUrl()) for i in result]\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></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>0</int> </value> + </item> + <item> + <key> <string>co_varnames</string> </key> + <value> + <tuple> + <string>_getattr_</string> + <string>context</string> + <string>section</string> + <string>None</string> + <string>section_value</string> + <string>result</string> + <string>current_destination_section</string> + <string>append</string> + <string>$append0</string> + <string>_getiter_</string> + <string>i</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>AccountingTransaction_getDestinationSectionItemList</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_getSourceSectionItemList.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_getSourceSectionItemList.xml index ea70829219..e081ca8338 100644 --- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_getSourceSectionItemList.xml +++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_getSourceSectionItemList.xml @@ -69,12 +69,22 @@ if section_cat in (None, \'\') : \n section_cat = context.getPortalDefaultSectionCategory()\n \n -# get the organisations belonging to this group\n -section_cat_obj = context.portal_categories.resolveCategory(section_cat)\n -valids = section_cat_obj.getGroupRelatedValueList(portal_type=\'Organisation\')\n +section_cat_obj = None\n +result = []\n +\n +if section_cat is not None:\n + # get the organisations belonging to this group\n + section_cat_obj = context.portal_categories.resolveCategory(section_cat)\n +\n +if section_cat_obj is not None:\n + result = section_cat_obj.getGroupRelatedValueList(portal_type=\'Organisation\')\n +\n +current_source_section = context.getSourceSectionValue()\n +if current_source_section is not None and current_source_section not in result:\n + result.append(current_source_section)\n \n # convert to ListField format\n -return [(valid.getTitle(), valid.getRelativeUrl()) for valid in valids]\n +return [(i.getTitle(), i.getRelativeUrl()) for i in result]\n </string> </value> </item> <item> @@ -122,11 +132,12 @@ return [(valid.getTitle(), valid.getRelativeUrl()) for valid in valids]\n <string>section_cat</string> <string>None</string> <string>section_cat_obj</string> - <string>valids</string> + <string>result</string> + <string>current_source_section</string> <string>append</string> <string>$append0</string> <string>_getiter_</string> - <string>valid</string> + <string>i</string> </tuple> </value> </item> diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewFieldLibrary/my_destination_section.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewFieldLibrary/my_destination_section.xml index 1b02ab87b9..974d85c2ec 100644 --- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewFieldLibrary/my_destination_section.xml +++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewFieldLibrary/my_destination_section.xml @@ -275,7 +275,7 @@ <dictionary> <item> <key> <string>_text</string> </key> - <value> <string>here/Base_getPreferredSectionItemList</string> </value> + <value> <string>here/AccountingTransaction_getDestinationSectionItemList</string> </value> </item> </dictionary> </pickle> diff --git a/bt5/erp5_accounting/bt/change_log b/bt5/erp5_accounting/bt/change_log index b0f1fd7af0..0de04aef57 100644 --- a/bt5/erp5_accounting/bt/change_log +++ b/bt5/erp5_accounting/bt/change_log @@ -1,3 +1,6 @@ +2008-1-21 yusei +* Section drop down list in accounting transactions should always show existing values.(bug #510) + 2008-1-18 yusei * proxify accounting transaction view forms. diff --git a/bt5/erp5_accounting/bt/revision b/bt5/erp5_accounting/bt/revision index ea5ca3642f..dd35c6b71f 100644 --- a/bt5/erp5_accounting/bt/revision +++ b/bt5/erp5_accounting/bt/revision @@ -1 +1 @@ -547 \ No newline at end of file +548 \ No newline at end of file -- 2.30.9