[Erp5-report] r34581 jerome - in /erp5/trunk/bt5/erp5_accounting: SkinTemplateItem/portal_s...

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Apr 15 15:08:34 CEST 2010


Author: jerome
Date: Thu Apr 15 15:08:33 2010
New Revision: 34581

URL: http://svn.erp5.org?rev=34581&view=rev
Log:
* add an update button on account statement, and reflect selection of section category in the list of possible third parties and bank account
* cleanup and document AccountModule_getBankAccountItemList
* extend a bit Account_zDistinctSectionList to support this

Modified:
    erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getBankAccountItemList.xml
    erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewAccountStatementReportDialog.xml
    erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewAccountStatementReportDialog/your_mirror_section.xml
    erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewAccountStatementReportDialog/your_payment.xml
    erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_getDestinationSectionItemList.xml
    erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_zDistinctSectionList.xml
    erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_viewJournalDialog/your_payment.xml
    erp5/trunk/bt5/erp5_accounting/bt/revision

Modified: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getBankAccountItemList.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getBankAccountItemList.xml?rev=34581&r1=34580&r2=34581&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getBankAccountItemList.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getBankAccountItemList.xml [utf8] Thu Apr 15 15:08:33 2010
@@ -53,36 +53,52 @@
         </item>
         <item>
             <key> <string>_body</string> </key>
-            <value> <string>portal = context.getPortalObject()\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
-\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 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
-\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
+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
+    # 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
@@ -113,7 +129,7 @@
         </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 @@
                   <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 @@
                           <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>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>search_kw</string>
-                            <string>_write_</string>
-                            <string>_apply_</string>
-                            <string>bank_account_list</string>
                             <string>uid_list</string>
+                            <string>section_uid</string>
                             <string>item_list</string>
                             <string>_getiter_</string>
                             <string>bank</string>
@@ -169,6 +189,8 @@
               <tuple>
                 <none/>
                 <int>0</int>
+                <none/>
+                <int>0</int>
               </tuple>
             </value>
         </item>

Modified: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewAccountStatementReportDialog.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewAccountStatementReportDialog.xml?rev=34581&r1=34580&r2=34581&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewAccountStatementReportDialog.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewAccountStatementReportDialog.xml [utf8] Thu Apr 15 15:08:33 2010
@@ -39,6 +39,16 @@
         <item>
             <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>
@@ -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>

Modified: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewAccountStatementReportDialog/your_mirror_section.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewAccountStatementReportDialog/your_mirror_section.xml?rev=34581&r1=34580&r2=34581&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewAccountStatementReportDialog/your_mirror_section.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewAccountStatementReportDialog/your_mirror_section.xml [utf8] Thu Apr 15 15:08:33 2010
@@ -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>

Modified: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewAccountStatementReportDialog/your_payment.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewAccountStatementReportDialog/your_payment.xml?rev=34581&r1=34580&r2=34581&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewAccountStatementReportDialog/your_payment.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewAccountStatementReportDialog/your_payment.xml [utf8] Thu Apr 15 15:08:33 2010
@@ -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>

Modified: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_getDestinationSectionItemList.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_getDestinationSectionItemList.xml?rev=34581&r1=34580&r2=34581&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_getDestinationSectionItemList.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_getDestinationSectionItemList.xml [utf8] Thu Apr 15 15:08:33 2010
@@ -53,16 +53,14 @@
         </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
+  node_uid = account.getUid()\n
 \n
-node_uid = None\n
-if account is not None :\n
-  node_uid = account.getUid()\n
 \n
 ptype_translated_dict = {}\n
 def translatePortalType(ptype) :\n
@@ -71,8 +69,15 @@
     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 @@
         </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 @@
                   <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 @@
             <value>
               <tuple>
                 <string></string>
+                <string></string>
+                <int>1</int>
               </tuple>
             </value>
         </item>
@@ -149,7 +159,7 @@
         </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>

Modified: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_zDistinctSectionList.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_zDistinctSectionList.xml?rev=34581&r1=34580&r2=34581&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_zDistinctSectionList.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Account_zDistinctSectionList.xml [utf8] Thu Apr 15 15:08:33 2010
@@ -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 @@
   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
-</dtml-if>\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 @@
   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
-</dtml-if>\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

Modified: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_viewJournalDialog/your_payment.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_viewJournalDialog/your_payment.xml?rev=34581&r1=34580&r2=34581&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_viewJournalDialog/your_payment.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_viewJournalDialog/your_payment.xml [utf8] Thu Apr 15 15:08:33 2010
@@ -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>

Modified: erp5/trunk/bt5/erp5_accounting/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/bt/revision?rev=34581&r1=34580&r2=34581&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/bt/revision [utf8] (original)
+++ erp5/trunk/bt5/erp5_accounting/bt/revision [utf8] Thu Apr 15 15:08:33 2010
@@ -1,1 +1,1 @@
-1178
+1181




More information about the Erp5-report mailing list