diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getBankAccountItemList.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getBankAccountItemList.xml index e26f11bf03e4ddade3106d20ae8e939de50d2aca..741fe779d9b84e01adfadef847f73d0fb691a16e 100644 --- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getBankAccountItemList.xml +++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getBankAccountItemList.xml @@ -53,37 +53,53 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string>portal = context.getPortalObject()\n + <value> <string>"""Returns an item list of the acceptable bank accounts.\n +If `organisation` is passed, then we only show bank accounts available for that\n +organisation, using the following policy:\n + - if organisation contains bank accounts directly, only those bank accounts\n + can be selected\n + - if organisation higher in the group hierarchy contains bank accounts, bank\n + accounts from parent organisations can be selected\n + - it means a higher in the group cannot use bank account from organisations\n + below, maybe we\'ll want to change this ...\n \n -if not organisation:\n - organisation = portal.portal_preferences\\\n - .getPreferredAccountingTransactionSourceSection()\n -\n -if not organisation:\n - return [(\'\', \'\')]\n -\n -organisation_value = portal.restrictedTraverse(organisation)\n -group_value = organisation_value.getGroupValue(None)\n -\n -search_kw = {\n - \'portal_type\': portal.getPortalPaymentNodeTypeList(),\n -}\n +If organisation is not passed, this script will return all bank accounts\n +applicable for section_category and section_category_strict_membership.\n +"""\n +portal = context.getPortalObject()\n \n +search_kw = dict(portal_type=portal.getPortalPaymentNodeTypeList())\n if skip_invalidated_bank_accounts:\n search_kw[\'validation_state\'] = \'!=invalidated\'\n \n -# if organisation contains bank accounts, only take into account those.\n -bank_account_list = organisation_value.searchFolder(**search_kw)\n +if organisation:\n + organisation_value = portal.restrictedTraverse(organisation)\n +\n + # if organisation contains bank accounts, only take into account those.\n + bank_account_list = organisation_value.searchFolder(**search_kw)\n \n -if not bank_account_list:\n - uid_list = []\n - while group_value.getPortalType() != \'Base Category\':\n - uid_list.append(group_value.getUid())\n - group_value = group_value.getParentValue()\n - search_kw[\'parent_strict_group_uid\'] = uid_list\n - search_kw[\'parent_portal_type\'] = \'Organisation\'\n + # else we lookup in parent organisations\n + if not bank_account_list:\n + group_value = organisation_value.getGroupValue(None)\n + uid_list = []\n + while group_value.getPortalType() != \'Base Category\':\n + uid_list.append(group_value.getUid())\n + group_value = group_value.getParentValue()\n + search_kw[\'parent_strict_group_uid\'] = uid_list\n + search_kw[\'parent_portal_type\'] = \'Organisation\'\n + bank_account_list = portal.portal_catalog(**search_kw)\n +\n +else:\n + if section_category is None:\n + section_category = portal.portal_preferences\\\n + .getPreferredAccountingTransactionSectionCategory()\n + section_uid = portal.Base_getSectionUidListForSectionCategory(\n + section_category=section_category,\n + strict_membership=section_category_strict_membership)\n + search_kw[\'parent_uid\'] = section_uid\n bank_account_list = portal.portal_catalog(**search_kw)\n \n +\n item_list = [(\'\', \'\')]\n for bank in bank_account_list:\n bank = bank.getObject()\n @@ -113,7 +129,7 @@ return item_list\n </item> <item> <key> <string>_params</string> </key> - <value> <string>organisation=None, skip_invalidated_bank_accounts=0</string> </value> + <value> <string>organisation=None, skip_invalidated_bank_accounts=0, section_category=None, section_category_strict_membership=False</string> </value> </item> <item> <key> <string>errors</string> </key> @@ -133,7 +149,7 @@ return item_list\n <dictionary> <item> <key> <string>co_argcount</string> </key> - <value> <int>2</int> </value> + <value> <int>4</int> </value> </item> <item> <key> <string>co_varnames</string> </key> @@ -141,17 +157,21 @@ return item_list\n <tuple> <string>organisation</string> <string>skip_invalidated_bank_accounts</string> + <string>section_category</string> + <string>section_category_strict_membership</string> <string>_getattr_</string> <string>context</string> <string>portal</string> - <string>organisation_value</string> - <string>None</string> - <string>group_value</string> + <string>dict</string> <string>search_kw</string> <string>_write_</string> + <string>organisation_value</string> <string>_apply_</string> <string>bank_account_list</string> + <string>None</string> + <string>group_value</string> <string>uid_list</string> + <string>section_uid</string> <string>item_list</string> <string>_getiter_</string> <string>bank</string> @@ -169,6 +189,8 @@ return item_list\n <tuple> <none/> <int>0</int> + <none/> + <int>0</int> </tuple> </value> </item> diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewAccountStatementReportDialog.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewAccountStatementReportDialog.xml index d9eed7146b62d07641e427eab75e16278f1b8f7e..02f43bd0e41ac742ac0e636026da20e546463643 100644 --- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewAccountStatementReportDialog.xml +++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewAccountStatementReportDialog.xml @@ -40,6 +40,16 @@ <key> <string>action</string> </key> <value> <string>AccountModule_viewAccountStatementReport</string> </value> </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>edit_order</string> </key> + <value> + <list/> + </value> + </item> <item> <key> <string>encoding</string> </key> <value> <string>UTF-8</string> </value> @@ -143,6 +153,10 @@ </item> <item> <key> <string>update_action</string> </key> + <value> <string>AccountModule_viewAccountStatementReportDialog</string> </value> + </item> + <item> + <key> <string>update_action_title</string> </key> <value> <string></string> </value> </item> </dictionary> diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewAccountStatementReportDialog/your_mirror_section.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewAccountStatementReportDialog/your_mirror_section.xml index 45d9715a6f5d9c371771bce0821e6fce7f1fb4d8..9962eafeff90c53585611fabfa135561d1965df5 100644 --- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewAccountStatementReportDialog/your_mirror_section.xml +++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewAccountStatementReportDialog/your_mirror_section.xml @@ -269,11 +269,8 @@ <record id="2" aka="AAAAAAAAAAI="> <pickle> <tuple> - <tuple> - <string>Products.Formulator.TALESField</string> - <string>TALESMethod</string> - </tuple> - <none/> + <global name="TALESMethod" module="Products.Formulator.TALESField"/> + <tuple/> </tuple> </pickle> <pickle> @@ -288,18 +285,15 @@ <record id="3" aka="AAAAAAAAAAM="> <pickle> <tuple> - <tuple> - <string>Products.Formulator.TALESField</string> - <string>TALESMethod</string> - </tuple> - <none/> + <global name="TALESMethod" module="Products.Formulator.TALESField"/> + <tuple/> </tuple> </pickle> <pickle> <dictionary> <item> <key> <string>_text</string> </key> - <value> <string>python:here.Account_getDestinationSectionItemList(account = request.get(\'account\', \'\'))</string> </value> + <value> <string>python:here.Account_getDestinationSectionItemList(account=request.get(\'your_node\', \'\'), section_category=request.get(\'your_section_category\', preferences.getPreferredAccountingTransactionSectionCategory()), section_category_strict_membership=request.get(\'your_section_category_strict\'))</string> </value> </item> </dictionary> </pickle> diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewAccountStatementReportDialog/your_payment.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewAccountStatementReportDialog/your_payment.xml index 409991e75c088b4252a2e7293c308268386b82b5..891f024a23924c33d7b3fb065c5314d8ed1c1551 100644 --- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewAccountStatementReportDialog/your_payment.xml +++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewAccountStatementReportDialog/your_payment.xml @@ -269,11 +269,8 @@ <record id="2" aka="AAAAAAAAAAI="> <pickle> <tuple> - <tuple> - <string>Products.Formulator.TALESField</string> - <string>TALESMethod</string> - </tuple> - <none/> + <global name="TALESMethod" module="Products.Formulator.TALESField"/> + <tuple/> </tuple> </pickle> <pickle> @@ -288,18 +285,15 @@ <record id="3" aka="AAAAAAAAAAM="> <pickle> <tuple> - <tuple> - <string>Products.Formulator.TALESField</string> - <string>TALESMethod</string> - </tuple> - <none/> + <global name="TALESMethod" module="Products.Formulator.TALESField"/> + <tuple/> </tuple> </pickle> <pickle> <dictionary> <item> <key> <string>_text</string> </key> - <value> <string>python: here.AccountModule_getBankAccountItemList()</string> </value> + <value> <string>python: context.AccountModule_getBankAccountItemList( section_category=request.get(\'your_section_category\'), section_category_strict_membership=request.get(\'your_section_category_strict\'))</string> </value> </item> </dictionary> </pickle> diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_getDestinationSectionItemList.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_getDestinationSectionItemList.xml index 41a619489dca510a42847745efc4d6ec10042635..53c1a8f02646abb5df81298cec315d8df25dbc44 100644 --- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_getDestinationSectionItemList.xml +++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_getDestinationSectionItemList.xml @@ -53,17 +53,15 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string>account = None\n -if account == \'\' :\n + <value> <string>node_uid=None\n +if not account:\n if (hasattr(context, \'getPortalType\') and context.getPortalType() == \'Account\') :\n - account = context\n + node_uid = context.getUid()\n elif same_type(account, \'\') :\n account = context.getPortalObject().restrictedTraverse(account)\n -\n -node_uid = None\n -if account is not None :\n node_uid = account.getUid()\n \n +\n ptype_translated_dict = {}\n def translatePortalType(ptype) :\n """Translate portal_type without retrieving the object from ZODB."""\n @@ -71,8 +69,15 @@ def translatePortalType(ptype) :\n ptype_translated_dict[ptype] = context.Base_translateString(ptype)\n return ptype_translated_dict[ptype]\n \n +section_uid = []\n +if section_category:\n + section_uid = context.Base_getSectionUidListForSectionCategory(\n + section_category, strict_membership=section_category_strict_membership)\n +\n +\n item_list = [("", "")]\n -for entity in context.Account_zDistinctSectionList(node_uid = node_uid):\n +for entity in context.Account_zDistinctSectionList(node_uid=node_uid,\n + section_uid=section_uid):\n item_list.append(("%s (%s)" % ( entity[\'title\'],\n translatePortalType(entity[\'portal_type\'])),\n entity[\'relative_url\']))\n @@ -88,7 +93,7 @@ return item_list\n </item> <item> <key> <string>_params</string> </key> - <value> <string>account = \'\'</string> </value> + <value> <string>account=\'\', section_category=\'\', section_category_strict_membership=True</string> </value> </item> <item> <key> <string>errors</string> </key> @@ -108,21 +113,24 @@ return item_list\n <dictionary> <item> <key> <string>co_argcount</string> </key> - <value> <int>1</int> </value> + <value> <int>3</int> </value> </item> <item> <key> <string>co_varnames</string> </key> <value> <tuple> <string>account</string> + <string>section_category</string> + <string>section_category_strict_membership</string> <string>None</string> + <string>node_uid</string> <string>hasattr</string> <string>context</string> <string>_getattr_</string> <string>same_type</string> - <string>node_uid</string> <string>ptype_translated_dict</string> <string>translatePortalType</string> + <string>section_uid</string> <string>item_list</string> <string>_getiter_</string> <string>entity</string> @@ -140,6 +148,8 @@ return item_list\n <value> <tuple> <string></string> + <string></string> + <int>1</int> </tuple> </value> </item> @@ -149,7 +159,7 @@ return item_list\n </item> <item> <key> <string>title</string> </key> - <value> <string>TODO: rename as Account_getMirrorSectionItemList</string> </value> + <value> <string>TODO: rename into AccountModule_getMirrorSectionItemList</string> </value> </item> <item> <key> <string>warnings</string> </key> diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_zDistinctSectionList.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_zDistinctSectionList.xml index 367e9b8a0642584b81efe15f6ecfafba9fa3b247..2861f4d6b595afc81856cf059be4d39e7bc51f7f 100644 --- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_zDistinctSectionList.xml +++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_zDistinctSectionList.xml @@ -44,9 +44,14 @@ </value> </item> <item> - <key> <string>section_category</string> </key> + <key> <string>section_uid</string> </key> <value> - <dictionary/> + <dictionary> + <item> + <key> <string>type</string> </key> + <value> <string>list</string> </value> + </item> + </dictionary> </value> </item> <item> @@ -69,7 +74,7 @@ <list> <string>node_uid</string> <string>at_date</string> - <string>section_category</string> + <string>section_uid</string> <string>simulation_state</string> </list> </value> @@ -132,7 +137,7 @@ <key> <string>arguments_src</string> </key> <value> <string>node_uid\r\n at_date\r\n -section_category\r\n +section_uid:list\r\n simulation_state:list</string> </value> </item> <item> @@ -195,11 +200,17 @@ WHERE\n AND stock.date <= <dtml-sqlvar at_date type="datetime">\n </dtml-if>\n <dtml-if simulation_state>\n - AND ( <dtml-in simulation_state>\n - stock.simulation_state = <dtml-sqlvar sequence-item type="string">\n - <dtml-unless sequence-end>OR </dtml-unless>\n - </dtml-in> )\n + AND ( stock.simulation_state IN (<dtml-in simulation_state><dtml-sqlvar sequence-item type="string">\n + <dtml-unless sequence-end>, </dtml-unless></dtml-in>) )\n </dtml-if>\n +\n +<dtml-if section_uid>\n + AND (\n + stock.section_uid IN ( <dtml-in section_uid><dtml-sqlvar sequence-item type="int">\n + <dtml-unless sequence-end>, </dtml-unless> </dtml-in> )\n + )\n +</dtml-if>\n +\n AND stock.portal_type in ( <dtml-in getPortalAccountingMovementTypeList><dtml-sqlvar\n sequence-item type="string"><dtml-unless sequence-end>, </dtml-unless></dtml-in> )\n <dtml-if "query[\'where_expression\']">\n @@ -271,11 +282,17 @@ WHERE\n AND stock.date <= <dtml-sqlvar at_date type="datetime">\n </dtml-if>\n <dtml-if simulation_state>\n - AND ( <dtml-in simulation_state>\n - stock.simulation_state = <dtml-sqlvar sequence-item type="string">\n - <dtml-unless sequence-end>OR </dtml-unless>\n - </dtml-in> )\n + AND ( stock.simulation_state IN (<dtml-in simulation_state><dtml-sqlvar sequence-item type="string">\n + <dtml-unless sequence-end>, </dtml-unless></dtml-in>) )\n +</dtml-if>\n +\n +<dtml-if section_uid>\n + AND (\n + stock.section_uid IN ( <dtml-in section_uid><dtml-sqlvar sequence-item type="int">\n + <dtml-unless sequence-end>, </dtml-unless> </dtml-in> )\n + )\n </dtml-if>\n +\n AND stock.portal_type in ( <dtml-in getPortalAccountingMovementTypeList><dtml-sqlvar\n sequence-item type="string"><dtml-unless sequence-end>, </dtml-unless></dtml-in> )\n <dtml-if "query[\'where_expression\']">\n diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_viewJournalDialog/your_payment.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_viewJournalDialog/your_payment.xml index b7605a92c65253bb1148c6171c688b2a1974d8df..99a5b6202495a2d5869ef7415bd84f5c22042a91 100644 --- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_viewJournalDialog/your_payment.xml +++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_viewJournalDialog/your_payment.xml @@ -267,18 +267,15 @@ <record id="2" aka="AAAAAAAAAAI="> <pickle> <tuple> - <tuple> - <string>Products.Formulator.TALESField</string> - <string>TALESMethod</string> - </tuple> - <none/> + <global name="TALESMethod" module="Products.Formulator.TALESField"/> + <tuple/> </tuple> </pickle> <pickle> <dictionary> <item> <key> <string>_text</string> </key> - <value> <string>here/AccountModule_getBankAccountItemList</string> </value> + <value> <string>python: context.AccountModule_getBankAccountItemList( section_category=request.get(\'your_section_category\'), section_category_strict_membership=request.get(\'your_section_category_strict\'))</string> </value> </item> </dictionary> </pickle> diff --git a/bt5/erp5_accounting/bt/revision b/bt5/erp5_accounting/bt/revision index ac2fca59ce153a169b8807a41a93b3db9dbe21a6..2a9ab72883a2f8595d17df74f3973789f7b761fa 100644 --- a/bt5/erp5_accounting/bt/revision +++ b/bt5/erp5_accounting/bt/revision @@ -1 +1 @@ -1178 \ No newline at end of file +1181 \ No newline at end of file