[Erp5-report] r17088 - in /erp5/trunk/products/ERP5: Tool/ tests/

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Oct 22 13:34:47 CEST 2007


Author: jerome
Date: Mon Oct 22 13:34:47 2007
New Revision: 17088

URL: http://svn.erp5.org?rev=17088&view=rev
Log:
Add more columns in default group by for getMovementHistoryList, this way when
we have a movement with same source and same destination, it shows two distinct
lines in getMovementHistoryList
Update the TODOs for testInventoryAPI


Modified:
    erp5/trunk/products/ERP5/Tool/SimulationTool.py
    erp5/trunk/products/ERP5/tests/testInventoryAPI.py

Modified: erp5/trunk/products/ERP5/Tool/SimulationTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Tool/SimulationTool.py?rev=17088&r1=17087&r2=17088&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Tool/SimulationTool.py (original)
+++ erp5/trunk/products/ERP5/Tool/SimulationTool.py Mon Oct 22 13:34:47 2007
@@ -844,7 +844,10 @@
       If no group by is provided, use the default group by: movement, node and
       resource, unless movement_list_mode is true, in that case, group by
       movement, node, resource and date (this is historically the default in
-      getMovementHistoryList).
+      getMovementHistoryList), section, mirror_section and payment (this is to
+      make sure two lines will appear when we are, for instance both source and
+      destination, implementation might not be optimal, because it uses lots of
+      group by statements in SQL).
       """
       new_group_by_dict = {}
       if not ignore_group_by:
@@ -861,6 +864,10 @@
           new_group_by_dict['group_by_resource'] = 1
           if movement_list_mode:
             new_group_by_dict['group_by_date'] = 1
+            new_group_by_dict['group_by_mirror_node'] = 1
+            new_group_by_dict['group_by_section'] = 1
+            new_group_by_dict['group_by_mirror_section'] = 1
+            new_group_by_dict['group_by_payment'] = 1
       return new_group_by_dict
 
     security.declareProtected(Permissions.AccessContentsInformation,

Modified: erp5/trunk/products/ERP5/tests/testInventoryAPI.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testInventoryAPI.py?rev=17088&r1=17087&r2=17088&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testInventoryAPI.py (original)
+++ erp5/trunk/products/ERP5/tests/testInventoryAPI.py Mon Oct 22 13:34:47 2007
@@ -29,7 +29,7 @@
 """Unit Tests for Inventory API.
 
 TODO: test variation
-
+      test selection_domain, selection_report
 """
 
 import os
@@ -1271,6 +1271,17 @@
                               source_value=self.node,
                               destination_value=self.node )
     
+    mvt_history_list = getMovementHistoryList(
+                            node_uid=self.node.getUid(),)
+    self.assertEquals(2, len(mvt_history_list))
+    self.assertEquals(0, sum([r.total_quantity for r in mvt_history_list]))
+
+  def testSameNodeSameDates(self):
+    getMovementHistoryList = self.getSimulationTool().getMovementHistoryList
+    mvt = self._makeMovement( quantity=2,
+                              start_date=DateTime(),
+                              source_value=self.node,
+                              destination_value=self.node )
     mvt_history_list = getMovementHistoryList(
                             node_uid=self.node.getUid(),)
     self.assertEquals(2, len(mvt_history_list))




More information about the Erp5-report mailing list