[Erp5-report] r20117 - in /erp5/trunk/bt5/erp5_accounting: SkinTemplateItem/portal_skins/er...

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Mar 25 15:01:48 CET 2008


Author: jerome
Date: Tue Mar 25 15:01:47 2008
New Revision: 20117

URL: http://svn.erp5.org?rev=20117&view=rev
Log:
In ungrouping mode, checking one line is enough to remove the grouping reference on this line and all lines that are grouped with it.

Modified:
    erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionLine_resetGroupingReference.xml
    erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_setGroupingReference.xml
    erp5/trunk/bt5/erp5_accounting/bt/revision

Modified: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionLine_resetGroupingReference.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionLine_resetGroupingReference.xml?rev=20117&r1=20116&r2=20117&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionLine_resetGroupingReference.xml (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionLine_resetGroupingReference.xml Tue Mar 25 15:01:47 2008
@@ -70,6 +70,7 @@
 If the parameter keep_if_valid_group is true, then the grouping reference\n
 will be kept as is if the group is still valid, ie. the total quantity\n
 of all accounting lines in the group is 0.\n
+Returns the list of ungroupped lines.\n
 """\n
 portal = context.getPortalObject()\n
 precision = context.getResourceValue(portal_type=\'Currency\').getQuantityPrecision()\n
@@ -98,6 +99,8 @@
   \n
 for line in line_list:\n
   line.setGroupingReference(None)\n
+\n
+return line_list\n
 </string> </value>
         </item>
         <item>

Modified: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_setGroupingReference.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_setGroupingReference.xml?rev=20117&r1=20116&r2=20117&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_setGroupingReference.xml (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_setGroupingReference.xml Tue Mar 25 15:01:47 2008
@@ -74,7 +74,6 @@
 getobject = portal.portal_catalog.getobject\n
 N_ = portal.Base_translateString\n
 psm = N_(\'Nothing matches\')\n
-reset = 0\n
 request = container.REQUEST\n
 precision = request.get(\'precision\', 2)\n
 \n
@@ -124,7 +123,6 @@
   if grouped_line_list:\n
     psm = N_(\'${grouped_line_count} Lines Grouped\',\n
           mapping=dict(grouped_line_count=len(grouped_line_list)))\n
-    reset = 1\n
 \n
     # we check if we can mark some transaction as payed.\n
     transaction_list = {}\n
@@ -162,43 +160,20 @@
           except:\n
             # Workflow action not supported\n
             pass\n
+\n
+# or to ungroup based on how we are called.\n
 else:\n
   assert grouping == \'ungrouping\'\n
-  # or to ungroup based on how we are called.\n
-  amount_per_node_mirror_section = dict()\n
   # XXX is uids multi page safe here ?\n
   line_list = [getobject(line_uid) for line_uid in uids]\n
+  ungrouped_line_list = []\n
+\n
   for line in line_list:\n
-    if line.AccountingTransaction_isSourceView(): # XXX not optimal !\n
-      key = (line.getSource(), line.getDestinationSection())\n
-      amount = amount_per_node_mirror_section.get(key, 0)\n
-      amount_per_node_mirror_section[key] = amount +\\\n
-                          (line.getSourceInventoriatedTotalAssetPrice() or 0)\n
-    else:\n
-      key = (line.getDestination(), line.getSourceSection())\n
-      amount = amount_per_node_mirror_section.get(key, 0)\n
-      amount_per_node_mirror_section[key] = amount +\\\n
-                     (line.getDestinationInventoriatedTotalAssetPrice() or 0)\n
+    if line.getGroupingReference():\n
+      ungrouped_line_list.extend(line.AccountingTransactionLine_resetGroupingReference())\n
   \n
-  valid = 1\n
-  for node_mirror_section, amount in amount_per_node_mirror_section.items():\n
-    if round(amount, precision) != 0:\n
-      valid = 0\n
-  \n
-  if line_list:\n
-    ref = line_list[0].getGroupingReference()\n
-    for line in line_list:\n
-      if line.getGroupingReference() != ref:\n
-        valid = 0\n
-\n
-  if valid:\n
-    psm = N_(\'${ungrouped_line_count} Lines Ungrouped\',\n
-          mapping=dict(ungrouped_line_count=len(uids)))\n
-    reset = 1\n
-    for line in line_list:\n
-      line.setGroupingReference(None)\n
-  else:\n
-    psm = N_(\'Ungrouping refused. Check your selection\')\n
+  psm = N_(\'${ungrouped_line_count} Lines Ungrouped\',\n
+            mapping=dict(ungrouped_line_count=len(ungrouped_line_list)))\n
 \n
 request.set(\'portal_status_message\', psm)\n
 return context.AccountingTransactionModule_viewGroupingFastInputDialog(request)\n
@@ -269,7 +244,6 @@
                             <string>getobject</string>
                             <string>N_</string>
                             <string>psm</string>
-                            <string>reset</string>
                             <string>container</string>
                             <string>request</string>
                             <string>precision</string>
@@ -290,18 +264,11 @@
                             <string>account</string>
                             <string>date</string>
                             <string>AssertionError</string>
-                            <string>amount_per_node_mirror_section</string>
                             <string>append</string>
                             <string>$append0</string>
                             <string>line_uid</string>
                             <string>line_list</string>
-                            <string>key</string>
-                            <string>amount</string>
-                            <string>valid</string>
-                            <string>node_mirror_section</string>
-                            <string>round</string>
-                            <string>_getitem_</string>
-                            <string>ref</string>
+                            <string>ungrouped_line_list</string>
                           </tuple>
                         </value>
                     </item>

Modified: erp5/trunk/bt5/erp5_accounting/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/bt/revision?rev=20117&r1=20116&r2=20117&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/bt/revision (original)
+++ erp5/trunk/bt5/erp5_accounting/bt/revision Tue Mar 25 15:01:47 2008
@@ -1,1 +1,1 @@
-655
+656




More information about the Erp5-report mailing list