From b3d599ca7fb4a32d14fdad8baa5fe28db8669b27 Mon Sep 17 00:00:00 2001 From: Romain Courteaud <romain@nexedi.com> Date: Fri, 11 Jul 2008 08:51:50 +0000 Subject: [PATCH] Modify Account_getGapId, in order to handle the 'preferred_account_number_method' git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@22435 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../erp5_accounting/Account_getGapId.xml | 31 +- .../Preference_viewAccounting.xml | 7 + .../my_preferred_account_number_method.xml | 283 ++++++++++++++++++ bt5/erp5_accounting/bt/revision | 2 +- 4 files changed, 317 insertions(+), 6 deletions(-) create mode 100644 bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Preference_viewAccounting/my_preferred_account_number_method.xml diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_getGapId.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_getGapId.xml index 36c10922a8..f60afe18dc 100644 --- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_getGapId.xml +++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_getGapId.xml @@ -66,13 +66,26 @@ <item> <key> <string>_body</string> </key> <value> <string># This script returns the gap id for this account according to the current gap\n +# XXX This script is badly name, as it does not truly return a category ID.\n +# XXX Instead, the purpose of this script is more to return an account number to display\n \n -current_gap = context.getPortalObject().portal_preferences.getPreferredAccountingTransactionGap()\n +preference_tool = context.getPortalObject().portal_preferences\n \n -for gap in context.getGapValueList() : \n - if current_gap in gap.getPath() : \n - return gap.getId()\n -return \'\'\n +number_method = preference_tool.getPreferredAccountNumberMethod()\n +\n +if number_method == \'account_reference\':\n + return context.getReference(\'\')\n +\n +# elif number_method == \'gap_id\':\n +else:\n + # GAP id is the default rendering\n +\n + current_gap = preference_tool.getPreferredAccountingTransactionGap()\n +\n + for gap in context.getGapValueList() : \n + if current_gap in gap.getPath() : \n + return gap.getId()\n + return \'\'\n </string> </value> </item> <item> @@ -87,6 +100,12 @@ return \'\'\n <none/> </value> </item> + <item> + <key> <string>_owner</string> </key> + <value> + <none/> + </value> + </item> <item> <key> <string>_params</string> </key> <value> <string></string> </value> @@ -117,6 +136,8 @@ return \'\'\n <tuple> <string>_getattr_</string> <string>context</string> + <string>preference_tool</string> + <string>number_method</string> <string>current_gap</string> <string>_getiter_</string> <string>gap</string> diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Preference_viewAccounting.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Preference_viewAccounting.xml index 69ea7dedbd..4c2495ddea 100644 --- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Preference_viewAccounting.xml +++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Preference_viewAccounting.xml @@ -42,6 +42,12 @@ <tuple/> </value> </item> + <item> + <key> <string>_owner</string> </key> + <value> + <none/> + </value> + </item> <item> <key> <string>action</string> </key> <value> <string>Base_edit</string> </value> @@ -106,6 +112,7 @@ <list> <string>my_preferred_accounting_transaction_simulation_state_list</string> <string>my_preferred_accounting_transaction_gap</string> + <string>my_preferred_account_number_method</string> </list> </value> </item> diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Preference_viewAccounting/my_preferred_account_number_method.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Preference_viewAccounting/my_preferred_account_number_method.xml new file mode 100644 index 0000000000..b871549738 --- /dev/null +++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Preference_viewAccounting/my_preferred_account_number_method.xml @@ -0,0 +1,283 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <tuple> + <global name="ListField" module="Products.Formulator.StandardFields"/> + <tuple/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>id</string> </key> + <value> <string>my_preferred_account_number_method</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>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>whitespace_preserve</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>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>whitespace_preserve</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> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string>The preferred account number method.</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>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>1</int> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Account Number Method</string> </value> + </item> + <item> + <key> <string>unicode</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <int>0</int> </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_translateString(\'Account Reference\'), \'account_reference\'), (here.Base_translateString(\'GAP\'), \'gap_id\')]</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_accounting/bt/revision b/bt5/erp5_accounting/bt/revision index 9684b0f85d..f591613428 100644 --- a/bt5/erp5_accounting/bt/revision +++ b/bt5/erp5_accounting/bt/revision @@ -1 +1 @@ -723 \ No newline at end of file +724 \ No newline at end of file -- 2.30.9