[Erp5-report] r13652 - in /erp5/trunk/products/ERP5: bootstrap/erp5_core/SkinTemplateItem/p...

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Mar 26 16:11:10 CEST 2007


Author: jerome
Date: Mon Mar 26 16:11:08 2007
New Revision: 13652

URL: http://svn.erp5.org?rev=13652&view=rev
Log:
omit_input / omit_output was not working for movements using the same node,
same section but different payments.


Modified:
    erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventory.xml
    erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventoryList.xml
    erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetMovementHistoryList.xml
    erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zStatInventory.xml
    erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision
    erp5/trunk/products/ERP5/tests/testInventoryAPI.py

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventory.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventory.xml?rev=13652&r1=13651&r2=13652&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventory.xml (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventory.xml Mon Mar 26 16:11:08 2007
@@ -283,14 +283,16 @@
   AND (  stock.node_uid <> stock.mirror_node_uid\n
         OR stock.section_uid <> stock.mirror_section_uid\n
         OR stock.mirror_node_uid IS NULL\n
-        OR stock.mirror_section_uid IS NULL )\n
+        OR stock.mirror_section_uid IS NULL\n
+        OR stock.payment_uid IS NOT NULL )\n
 </dtml-if>\n
 <dtml-if omit_output>\n
   AND stock.quantity > 0\n
   AND (  stock.node_uid <> stock.mirror_node_uid\n
         OR stock.section_uid <> stock.mirror_section_uid\n
         OR stock.mirror_node_uid IS NULL\n
-        OR stock.mirror_section_uid IS NULL )\n
+        OR stock.mirror_section_uid IS NULL\n
+        OR stock.payment_uid IS NOT NULL )\n
 </dtml-if>\n
 \n
 <dtml-if input_simulation_state>\n
@@ -419,14 +421,16 @@
   AND (  stock.node_uid <> stock.mirror_node_uid\n
         OR stock.section_uid <> stock.mirror_section_uid\n
         OR stock.mirror_node_uid IS NULL\n
-        OR stock.mirror_section_uid IS NULL )\n
+        OR stock.mirror_section_uid IS NULL\n
+        OR stock.payment_uid IS NOT NULL )\n
 </dtml-if>\n
 <dtml-if omit_output>\n
   AND stock.quantity > 0\n
   AND (  stock.node_uid <> stock.mirror_node_uid\n
         OR stock.section_uid <> stock.mirror_section_uid\n
         OR stock.mirror_node_uid IS NULL\n
-        OR stock.mirror_section_uid IS NULL )\n
+        OR stock.mirror_section_uid IS NULL\n
+        OR stock.payment_uid IS NOT NULL )\n
 </dtml-if>\n
 \n
 <dtml-if input_simulation_state>\n

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventoryList.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventoryList.xml?rev=13652&r1=13651&r2=13652&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventoryList.xml (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventoryList.xml Mon Mar 26 16:11:08 2007
@@ -146,20 +146,20 @@
                         <key> <string>_keys</string> </key>
                         <value>
                           <list>
-                            <string>from_table_list</string>
-                            <string>where_expression</string>
-                            <string>order_by_expression</string>
-                            <string>group_by_expression</string>
-                            <string>selection_domain</string>
-                            <string>selection_report</string>
-                            <string>ignore_variation</string>
-                            <string>standardize</string>
-                            <string>omit_simulation</string>
-                            <string>section_filtered</string>
-                            <string>omit_input</string>
-                            <string>omit_output</string>
-                            <string>input_simulation_state</string>
-                            <string>output_simulation_state</string>
+<string>from_table_list</string>
+<string>where_expression</string>
+<string>order_by_expression</string>
+<string>group_by_expression</string>
+<string>selection_domain</string>
+<string>selection_report</string>
+<string>ignore_variation</string>
+<string>standardize</string>
+<string>omit_simulation</string>
+<string>section_filtered</string>
+<string>omit_input</string>
+<string>omit_output</string>
+<string>input_simulation_state</string>
+<string>output_simulation_state</string>
                           </list>
                         </value>
                     </item>
@@ -205,7 +205,9 @@
         </item>
         <item>
             <key> <string>connection_hook</string> </key>
-            <value> <string></string> </value>
+            <value>
+              <none/>
+            </value>
         </item>
         <item>
             <key> <string>connection_id</string> </key>
@@ -279,14 +281,16 @@
   AND ( stock.node_uid <> stock.mirror_node_uid\n
         OR stock.section_uid <> stock.mirror_section_uid\n
         OR stock.mirror_node_uid IS NULL\n
-        OR stock.mirror_section_uid IS NULL )\n
+        OR stock.mirror_section_uid IS NULL\n
+        OR stock.payment_uid IS NOT NULL )\n
 </dtml-if>\n
 <dtml-if omit_output>\n
   AND stock.quantity > 0\n
   AND ( stock.node_uid <> stock.mirror_node_uid\n
         OR stock.section_uid <> stock.mirror_section_uid\n
         OR stock.mirror_node_uid IS NULL\n
-        OR stock.mirror_section_uid IS NULL )\n
+        OR stock.mirror_section_uid IS NULL\n
+        OR stock.payment_uid IS NOT NULL )\n
 </dtml-if>\n
 \n
 <dtml-if input_simulation_state>\n
@@ -419,14 +423,16 @@
   AND ( stock.node_uid <> stock.mirror_node_uid\n
         OR stock.section_uid <> stock.mirror_section_uid\n
         OR stock.mirror_node_uid IS NULL\n
-        OR stock.mirror_section_uid IS NULL )\n
+        OR stock.mirror_section_uid IS NULL\n
+        OR stock.payment_uid IS NOT NULL )\n
 </dtml-if>\n
 <dtml-if omit_output>\n
   AND stock.quantity > 0\n
   AND ( stock.node_uid <> stock.mirror_node_uid\n
         OR stock.section_uid <> stock.mirror_section_uid\n
         OR stock.mirror_node_uid IS NULL\n
-        OR stock.mirror_section_uid IS NULL )\n
+        OR stock.mirror_section_uid IS NULL\n
+        OR stock.payment_uid IS NOT NULL )\n
 </dtml-if>\n
 \n
 <dtml-if input_simulation_state>\n

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetMovementHistoryList.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetMovementHistoryList.xml?rev=13652&r1=13651&r2=13652&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetMovementHistoryList.xml (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetMovementHistoryList.xml Mon Mar 26 16:11:08 2007
@@ -156,23 +156,23 @@
                         <key> <string>_keys</string> </key>
                         <value>
                           <list>
-                            <string>from_table_list</string>
-                            <string>where_expression</string>
-                            <string>order_by_expression</string>
-                            <string>group_by_expression</string>
-                            <string>selection_domain</string>
-                            <string>selection_report</string>
-                            <string>ignore_variation</string>
-                            <string>standardize</string>
-                            <string>omit_simulation</string>
-                            <string>omit_input</string>
-                            <string>omit_output</string>
-                            <string>section_filtered</string>
-                            <string>initial_running_total_quantity</string>
-                            <string>initial_running_total_price</string>
-                            <string>input_simulation_state</string>
-                            <string>output_simulation_state</string>
-                            <string>precision</string>
+<string>from_table_list</string>
+<string>where_expression</string>
+<string>order_by_expression</string>
+<string>group_by_expression</string>
+<string>selection_domain</string>
+<string>selection_report</string>
+<string>ignore_variation</string>
+<string>standardize</string>
+<string>omit_simulation</string>
+<string>omit_input</string>
+<string>omit_output</string>
+<string>section_filtered</string>
+<string>initial_running_total_quantity</string>
+<string>initial_running_total_price</string>
+<string>input_simulation_state</string>
+<string>output_simulation_state</string>
+<string>precision</string>
                           </list>
                         </value>
                     </item>
@@ -630,7 +630,9 @@
         </item>
         <item>
             <key> <string>connection_hook</string> </key>
-            <value> <string></string> </value>
+            <value>
+              <none/>
+            </value>
         </item>
         <item>
             <key> <string>connection_id</string> </key>
@@ -717,14 +719,16 @@
   AND ( stock.node_uid <> stock.mirror_node_uid\n
         OR stock.section_uid <> stock.mirror_section_uid\n
         OR stock.mirror_node_uid IS NULL\n
-        OR stock.mirror_section_uid IS NULL )\n
+        OR stock.mirror_section_uid IS NULL\n
+        OR stock.payment_uid IS NOT NULL )\n
 </dtml-if>\n
 <dtml-if omit_output>\n
   AND stock.quantity > 0\n
   AND ( stock.node_uid <> stock.mirror_node_uid\n
         OR stock.section_uid <> stock.mirror_section_uid\n
         OR stock.mirror_node_uid IS NULL\n
-        OR stock.mirror_section_uid IS NULL )\n
+        OR stock.mirror_section_uid IS NULL\n
+        OR stock.payment_uid IS NOT NULL )\n
 </dtml-if>\n
 \n
 <dtml-if input_simulation_state>\n
@@ -873,14 +877,16 @@
   AND ( stock.node_uid <> stock.mirror_node_uid\n
         OR stock.section_uid <> stock.mirror_section_uid\n
         OR stock.mirror_node_uid IS NULL\n
-        OR stock.mirror_section_uid IS NULL )\n
+        OR stock.mirror_section_uid IS NULL\n
+        OR stock.payment_uid IS NOT NULL )\n
 </dtml-if>\n
 <dtml-if omit_output>\n
   AND stock.quantity > 0\n
   AND ( stock.node_uid <> stock.mirror_node_uid\n
         OR stock.section_uid <> stock.mirror_section_uid\n
         OR stock.mirror_node_uid IS NULL\n
-        OR stock.mirror_section_uid IS NULL )\n
+        OR stock.mirror_section_uid IS NULL\n
+        OR stock.payment_uid IS NOT NULL )\n
 </dtml-if>\n
 \n
 <dtml-if input_simulation_state>\n

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zStatInventory.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zStatInventory.xml?rev=13652&r1=13651&r2=13652&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zStatInventory.xml (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zStatInventory.xml Mon Mar 26 16:11:08 2007
@@ -158,22 +158,22 @@
                         <key> <string>_keys</string> </key>
                         <value>
                           <list>
-                            <string>query</string>
-                            <string>resource_uid</string>
-                            <string>from_date</string>
-                            <string>at_date</string>
-                            <string>to_date</string>
-                            <string>omit_simulation</string>
-                            <string>omit_input</string>
-                            <string>omit_output</string>
-                            <string>simulation_state</string>
-                            <string>section_category</string>
-                            <string>selection_domain</string>
-                            <string>selection_report</string>
-                            <string>closed_summary</string>
-                            <string>where_expression</string>
-                            <string>from_table_list</string>
-                            <string>selection_uids</string>
+<string>query</string>
+<string>resource_uid</string>
+<string>from_date</string>
+<string>at_date</string>
+<string>to_date</string>
+<string>omit_simulation</string>
+<string>omit_input</string>
+<string>omit_output</string>
+<string>simulation_state</string>
+<string>section_category</string>
+<string>selection_domain</string>
+<string>selection_report</string>
+<string>closed_summary</string>
+<string>where_expression</string>
+<string>from_table_list</string>
+<string>selection_uids</string>
                           </list>
                         </value>
                     </item>
@@ -306,6 +306,7 @@
      OR  stock.section_uid <> stock.mirror_section_uid\n
      OR  stock.mirror_node_uid IS NULL\n
      OR  stock.mirror_section_uid IS NULL\n
+     OR  stock.payment_uid IS NOT NULL\n
     )\n
   </dtml-if>\n
   <dtml-if omit_output>\n
@@ -314,6 +315,7 @@
      OR  stock.section_uid <> stock.mirror_section_uid\n
      OR  stock.mirror_node_uid IS NULL\n
      OR  stock.mirror_section_uid IS NULL\n
+     OR  stock.payment_uid IS NOT NULL\n
     )\n
   </dtml-if>\n
   <dtml-if simulation_state>\n
@@ -449,6 +451,7 @@
      OR  stock.section_uid <> stock.mirror_section_uid\n
      OR  stock.mirror_node_uid IS NULL\n
      OR  stock.mirror_section_uid IS NULL\n
+     OR  stock.payment_uid IS NOT NULL\n
     )\n
   </dtml-if>\n
   <dtml-if omit_output>\n
@@ -457,6 +460,7 @@
      OR  stock.section_uid <> stock.mirror_section_uid\n
      OR  stock.mirror_node_uid IS NULL\n
      OR  stock.mirror_section_uid IS NULL\n
+     OR  stock.payment_uid IS NOT NULL\n
     )\n
   </dtml-if>\n
   <dtml-if simulation_state>\n

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision?rev=13652&r1=13651&r2=13652&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision Mon Mar 26 16:11:08 2007
@@ -1,1 +1,1 @@
-279
+280

Modified: erp5/trunk/products/ERP5/tests/testInventoryAPI.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testInventoryAPI.py?rev=13652&r1=13651&r2=13652&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testInventoryAPI.py (original)
+++ erp5/trunk/products/ERP5/tests/testInventoryAPI.py Mon Mar 26 16:11:08 2007
@@ -88,10 +88,14 @@
     self.folder = self.portal.testing_folder
     
     self.section = self._makeOrganisation(title='Section')
+    self.other_section = self._makeOrganisation(title='Other Section')
     self.node = self._makeOrganisation(title='Node')
     self.other_node = self._makeOrganisation(title='Other Node')
     self.payment_node = self.section.newContent(
                                   title='Payment Node',
+                                  portal_type='Bank Account')
+    self.other_payment_node = self.section.newContent(
+                                  title='Other Payment Node',
                                   portal_type='Bank Account')
     self.mirror_section = self._makeOrganisation(title='Mirror Section')
     self.mirror_node = self._makeOrganisation(title='Mirror Node')
@@ -509,6 +513,93 @@
     self.assertEquals(0, getInventoryAssetPrice(precision=2,
                                                 node_uid=self.node.getUid()))
     
+  def test_OmitInputOmitOutput(self):
+    getInventory = self.getSimulationTool().getInventory
+    self._makeMovement(quantity=1, price=1)
+    self._makeMovement(quantity=-1, price=1)
+    # omit input ignores movement comming to this node
+    self.assertEquals(-1, getInventory(node_uid=self.node.getUid(),
+                                       omit_input=1))
+    # omit output ignores movement going to this node
+    self.assertEquals(1, getInventory(node_uid=self.node.getUid(),
+                                      omit_output=1))
+    # omit_output & omit_input return nothing in that case
+    self.assertEquals(0, getInventory(node_uid=self.node.getUid(),
+                                      omit_input=1,
+                                      omit_output=1))
+    # this also work with movements without source or without destination
+    self._makeMovement(quantity=-2, price=1, source_value=None)
+    self.assertEquals(-3, getInventory(node_uid=self.node.getUid(),
+                                       omit_input=1))
+    self.assertEquals(1, getInventory(node_uid=self.node.getUid(),
+                                      omit_output=1))
+    # and with movements without source section / desination sections
+    self._makeMovement(quantity=2, price=1, source_section_value=None)
+    self.assertEquals(-3, getInventory(node_uid=self.node.getUid(),
+                                       omit_input=1))
+    self.assertEquals(3, getInventory(node_uid=self.node.getUid(),
+                                      omit_output=1))
+    
+  def test_OmitInputOmitOutputWithDifferentSections(self):
+    getInventory = self.getSimulationTool().getInventory
+    self._makeMovement(quantity=2, price=1)
+    self._makeMovement(quantity=-3, price=1,
+                       destination_section_value=self.other_section )
+    self.assertEquals(0, getInventory(node_uid=self.node.getUid(),
+                                      section_uid=self.section.getUid(),
+                                      omit_input=1))
+    self.assertEquals(-3, getInventory(node_uid=self.node.getUid(),
+                                      section_uid=self.other_section.getUid(),
+                                      omit_input=1))
+    self.assertEquals(2, getInventory(node_uid=self.node.getUid(),
+                                      section_uid=self.section.getUid(),
+                                      omit_output=1))
+    self.assertEquals(0, getInventory(node_uid=self.node.getUid(),
+                                      section_uid=self.other_section.getUid(),
+                                      omit_output=1))
+    
+  def test_OmitInputOmitOutputWithDifferentPayment(self):
+    getInventory = self.getSimulationTool().getInventory
+    # simple case
+    self._makeMovement(quantity=2, price=1,
+                       destination_payment_value=self.payment_node )
+    self._makeMovement(quantity=-3, price=1,
+                       destination_payment_value=self.other_payment_node )
+    self.assertEquals(0, getInventory(node_uid=self.node.getUid(),
+                                      section_uid=self.section.getUid(),
+                                      payment_uid=self.payment_node.getUid(),
+                                      omit_input=1))
+    self.assertEquals(-3, getInventory(node_uid=self.node.getUid(),
+                                  section_uid=self.section.getUid(),
+                                  payment_uid=self.other_payment_node.getUid(),
+                                  omit_input=1))
+    self.assertEquals(2, getInventory(node_uid=self.node.getUid(),
+                                  section_uid=self.section.getUid(),
+                                  payment_uid=self.payment_node.getUid(),
+                                  omit_output=1))
+    self.assertEquals(0, getInventory(node_uid=self.node.getUid(),
+                                  section_uid=self.other_section.getUid(),
+                                  payment_uid=self.other_payment_node.getUid(),
+                                  omit_output=1))
+
+  def test_OmitInputOmitOutputWithDifferentPaymentSameNodeSameSection(self):
+    getInventory = self.getSimulationTool().getInventory
+    self._makeMovement(quantity=2, price=1,
+                       source_value=self.node,
+                       destination_value=self.node,
+                       source_section_value=self.section,
+                       destination_section_value=self.section,
+                       source_payment_value=self.other_payment_node,
+                       destination_payment_value=self.payment_node )
+    self.assertEquals(2, getInventory(node_uid=self.node.getUid(),
+                                       section_uid=self.section.getUid(),
+                                       payment_uid=self.payment_node.getUid(),
+                                       omit_output=1))
+    self.assertEquals(-2, getInventory(node_uid=self.node.getUid(),
+                           section_uid=self.section.getUid(),
+                           payment_uid=self.other_payment_node.getUid(),
+                           omit_input=1))
+
 
 class TestInventoryList(InventoryAPITestCase):
   """Tests getInventoryList methods.
@@ -601,6 +692,53 @@
     self.assertEquals([r for r in inventory_list if r.payment_uid ==
                        self.payment_node.getUid()][0].inventory, 200)
 
+  def test_OmitInputOmitOutput(self):
+    getInventoryList = self.getSimulationTool().getInventoryList
+    self._makeMovement(quantity=1, price=1)
+    self._makeMovement(quantity=-1, price=1)
+    # omit input ignores movement comming to this node
+    inventory_list = getInventoryList(node_uid=self.node.getUid(),
+                                      omit_input=1)
+    self.assertEquals(1, len(inventory_list))
+    self.assertEquals(-1, inventory_list[0].total_price)
+    self.assertEquals(-1, inventory_list[0].total_quantity)
+
+    # omit output ignores movement going to this node
+    inventory_list = getInventoryList(node_uid=self.node.getUid(),
+                                      omit_output=1)
+    self.assertEquals(1, len(inventory_list))
+    self.assertEquals(1, inventory_list[0].total_price)
+    self.assertEquals(1, inventory_list[0].total_quantity)
+
+    # omit_output & omit_input return nothing in that case
+    self.assertEquals(0, len(getInventoryList(node_uid=self.node.getUid(),
+                                              omit_input=1,
+                                              omit_output=1)))
+    
+  def test_OmitInputOmitOutputWithDifferentPaymentSameNodeSameSection(self):
+    getInventoryList = self.getSimulationTool().getInventoryList
+    self._makeMovement(quantity=2, price=1,
+                       source_value=self.node,
+                       destination_value=self.node,
+                       source_section_value=self.section,
+                       destination_section_value=self.section,
+                       source_payment_value=self.other_payment_node,
+                       destination_payment_value=self.payment_node )
+    inventory_list = getInventoryList(node_uid=self.node.getUid(),
+                                      section_uid=self.section.getUid(),
+                                      payment_uid=self.payment_node.getUid(),
+                                      omit_output=1)
+    self.assertEquals(1, len(inventory_list))
+    self.assertEquals(2, inventory_list[0].total_price)
+    self.assertEquals(2, inventory_list[0].total_quantity)
+
+    inventory_list = getInventoryList(node_uid=self.node.getUid(),
+                                section_uid=self.section.getUid(),
+                                payment_uid=self.other_payment_node.getUid(),
+                                omit_input=1)
+    self.assertEquals(1, len(inventory_list))
+    self.assertEquals(-2, inventory_list[0].total_price)
+    self.assertEquals(-2, inventory_list[0].total_quantity)
 
 
 class TestMovementHistoryList(InventoryAPITestCase):
@@ -1107,11 +1245,60 @@
     self.assertEquals(0, mvt_history_list[-1].running_total_quantity)
     self.assertEquals(0, mvt_history_list[-1].running_total_price)
 
+  def test_OmitInputOmitOutput(self):
+    getMovementHistoryList = self.getSimulationTool().getMovementHistoryList
+    self._makeMovement(quantity=1, price=1)
+    self._makeMovement(quantity=-1, price=1)
+    # omit input ignores movement comming to this node
+    mvt_history_list = getMovementHistoryList(node_uid=self.node.getUid(),
+                                              omit_input=1)
+    self.assertEquals(1, len(mvt_history_list))
+    self.assertEquals(-1, mvt_history_list[0].total_price)
+    self.assertEquals(-1, mvt_history_list[0].total_quantity)
+
+    # omit output ignores movement going to this node
+    mvt_history_list = getMovementHistoryList(node_uid=self.node.getUid(),
+                                              omit_output=1)
+    self.assertEquals(1, len(mvt_history_list))
+    self.assertEquals(1, mvt_history_list[0].total_price)
+    self.assertEquals(1, mvt_history_list[0].total_quantity)
+
+    self.assertEquals(0, len(getMovementHistoryList(
+                                              node_uid=self.node.getUid(),
+                                              omit_input=1,
+                                              omit_output=1)))
+    
+  def test_OmitInputOmitOutputWithDifferentPaymentSameNodeSameSection(self):
+    getMovementHistoryList = self.getSimulationTool().getMovementHistoryList
+    self._makeMovement(quantity=2, price=1,
+                       source_value=self.node,
+                       destination_value=self.node,
+                       source_section_value=self.section,
+                       destination_section_value=self.section,
+                       source_payment_value=self.other_payment_node,
+                       destination_payment_value=self.payment_node )
+    movement_history_list = getMovementHistoryList(
+                                      node_uid=self.node.getUid(),
+                                      section_uid=self.section.getUid(),
+                                      payment_uid=self.payment_node.getUid(),
+                                      omit_output=1)
+    self.assertEquals(1, len(movement_history_list))
+    self.assertEquals(2, movement_history_list[0].total_price)
+    self.assertEquals(2, movement_history_list[0].total_quantity)
+
+    movement_history_list = getMovementHistoryList(node_uid=self.node.getUid(),
+                                   section_uid=self.section.getUid(),
+                                   payment_uid=self.other_payment_node.getUid(),
+                                   omit_input=1)
+    self.assertEquals(1, len(movement_history_list))
+    self.assertEquals(-2, movement_history_list[0].total_price)
+    self.assertEquals(-2, movement_history_list[0].total_quantity)
+
 
 class TestInventoryStat(InventoryAPITestCase):
   """Tests Inventory Stat methods.
   """
-
+  # TODO
 
 if __name__ == '__main__':
   framework()




More information about the Erp5-report mailing list