Commit b97637ca authored by Jérome Perrin's avatar Jérome Perrin

omit_input / omit_output was not working for movements using the same node,

same section but different payments.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13652 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 4045f8e2
...@@ -283,14 +283,16 @@ WHERE\n ...@@ -283,14 +283,16 @@ WHERE\n
AND ( stock.node_uid <> stock.mirror_node_uid\n AND ( stock.node_uid <> stock.mirror_node_uid\n
OR stock.section_uid <> stock.mirror_section_uid\n OR stock.section_uid <> stock.mirror_section_uid\n
OR stock.mirror_node_uid IS NULL\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>\n
<dtml-if omit_output>\n <dtml-if omit_output>\n
AND stock.quantity > 0\n AND stock.quantity > 0\n
AND ( stock.node_uid <> stock.mirror_node_uid\n AND ( stock.node_uid <> stock.mirror_node_uid\n
OR stock.section_uid <> stock.mirror_section_uid\n OR stock.section_uid <> stock.mirror_section_uid\n
OR stock.mirror_node_uid IS NULL\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>\n
\n \n
<dtml-if input_simulation_state>\n <dtml-if input_simulation_state>\n
...@@ -419,14 +421,16 @@ WHERE\n ...@@ -419,14 +421,16 @@ WHERE\n
AND ( stock.node_uid <> stock.mirror_node_uid\n AND ( stock.node_uid <> stock.mirror_node_uid\n
OR stock.section_uid <> stock.mirror_section_uid\n OR stock.section_uid <> stock.mirror_section_uid\n
OR stock.mirror_node_uid IS NULL\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>\n
<dtml-if omit_output>\n <dtml-if omit_output>\n
AND stock.quantity > 0\n AND stock.quantity > 0\n
AND ( stock.node_uid <> stock.mirror_node_uid\n AND ( stock.node_uid <> stock.mirror_node_uid\n
OR stock.section_uid <> stock.mirror_section_uid\n OR stock.section_uid <> stock.mirror_section_uid\n
OR stock.mirror_node_uid IS NULL\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>\n
\n \n
<dtml-if input_simulation_state>\n <dtml-if input_simulation_state>\n
......
...@@ -146,20 +146,20 @@ ...@@ -146,20 +146,20 @@
<key> <string>_keys</string> </key> <key> <string>_keys</string> </key>
<value> <value>
<list> <list>
<string>from_table_list</string> <string>from_table_list</string>
<string>where_expression</string> <string>where_expression</string>
<string>order_by_expression</string> <string>order_by_expression</string>
<string>group_by_expression</string> <string>group_by_expression</string>
<string>selection_domain</string> <string>selection_domain</string>
<string>selection_report</string> <string>selection_report</string>
<string>ignore_variation</string> <string>ignore_variation</string>
<string>standardize</string> <string>standardize</string>
<string>omit_simulation</string> <string>omit_simulation</string>
<string>section_filtered</string> <string>section_filtered</string>
<string>omit_input</string> <string>omit_input</string>
<string>omit_output</string> <string>omit_output</string>
<string>input_simulation_state</string> <string>input_simulation_state</string>
<string>output_simulation_state</string> <string>output_simulation_state</string>
</list> </list>
</value> </value>
</item> </item>
...@@ -205,7 +205,9 @@ output_simulation_state:list</string> </value> ...@@ -205,7 +205,9 @@ output_simulation_state:list</string> </value>
</item> </item>
<item> <item>
<key> <string>connection_hook</string> </key> <key> <string>connection_hook</string> </key>
<value> <string></string> </value> <value>
<none/>
</value>
</item> </item>
<item> <item>
<key> <string>connection_id</string> </key> <key> <string>connection_id</string> </key>
...@@ -279,14 +281,16 @@ WHERE\n ...@@ -279,14 +281,16 @@ WHERE\n
AND ( stock.node_uid <> stock.mirror_node_uid\n AND ( stock.node_uid <> stock.mirror_node_uid\n
OR stock.section_uid <> stock.mirror_section_uid\n OR stock.section_uid <> stock.mirror_section_uid\n
OR stock.mirror_node_uid IS NULL\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>\n
<dtml-if omit_output>\n <dtml-if omit_output>\n
AND stock.quantity > 0\n AND stock.quantity > 0\n
AND ( stock.node_uid <> stock.mirror_node_uid\n AND ( stock.node_uid <> stock.mirror_node_uid\n
OR stock.section_uid <> stock.mirror_section_uid\n OR stock.section_uid <> stock.mirror_section_uid\n
OR stock.mirror_node_uid IS NULL\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>\n
\n \n
<dtml-if input_simulation_state>\n <dtml-if input_simulation_state>\n
...@@ -419,14 +423,16 @@ WHERE\n ...@@ -419,14 +423,16 @@ WHERE\n
AND ( stock.node_uid <> stock.mirror_node_uid\n AND ( stock.node_uid <> stock.mirror_node_uid\n
OR stock.section_uid <> stock.mirror_section_uid\n OR stock.section_uid <> stock.mirror_section_uid\n
OR stock.mirror_node_uid IS NULL\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>\n
<dtml-if omit_output>\n <dtml-if omit_output>\n
AND stock.quantity > 0\n AND stock.quantity > 0\n
AND ( stock.node_uid <> stock.mirror_node_uid\n AND ( stock.node_uid <> stock.mirror_node_uid\n
OR stock.section_uid <> stock.mirror_section_uid\n OR stock.section_uid <> stock.mirror_section_uid\n
OR stock.mirror_node_uid IS NULL\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>\n
\n \n
<dtml-if input_simulation_state>\n <dtml-if input_simulation_state>\n
......
...@@ -156,23 +156,23 @@ ...@@ -156,23 +156,23 @@
<key> <string>_keys</string> </key> <key> <string>_keys</string> </key>
<value> <value>
<list> <list>
<string>from_table_list</string> <string>from_table_list</string>
<string>where_expression</string> <string>where_expression</string>
<string>order_by_expression</string> <string>order_by_expression</string>
<string>group_by_expression</string> <string>group_by_expression</string>
<string>selection_domain</string> <string>selection_domain</string>
<string>selection_report</string> <string>selection_report</string>
<string>ignore_variation</string> <string>ignore_variation</string>
<string>standardize</string> <string>standardize</string>
<string>omit_simulation</string> <string>omit_simulation</string>
<string>omit_input</string> <string>omit_input</string>
<string>omit_output</string> <string>omit_output</string>
<string>section_filtered</string> <string>section_filtered</string>
<string>initial_running_total_quantity</string> <string>initial_running_total_quantity</string>
<string>initial_running_total_price</string> <string>initial_running_total_price</string>
<string>input_simulation_state</string> <string>input_simulation_state</string>
<string>output_simulation_state</string> <string>output_simulation_state</string>
<string>precision</string> <string>precision</string>
</list> </list>
</value> </value>
</item> </item>
...@@ -630,7 +630,9 @@ precision</string> </value> ...@@ -630,7 +630,9 @@ precision</string> </value>
</item> </item>
<item> <item>
<key> <string>connection_hook</string> </key> <key> <string>connection_hook</string> </key>
<value> <string></string> </value> <value>
<none/>
</value>
</item> </item>
<item> <item>
<key> <string>connection_id</string> </key> <key> <string>connection_id</string> </key>
...@@ -717,14 +719,16 @@ WHERE\n ...@@ -717,14 +719,16 @@ WHERE\n
AND ( stock.node_uid <> stock.mirror_node_uid\n AND ( stock.node_uid <> stock.mirror_node_uid\n
OR stock.section_uid <> stock.mirror_section_uid\n OR stock.section_uid <> stock.mirror_section_uid\n
OR stock.mirror_node_uid IS NULL\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>\n
<dtml-if omit_output>\n <dtml-if omit_output>\n
AND stock.quantity > 0\n AND stock.quantity > 0\n
AND ( stock.node_uid <> stock.mirror_node_uid\n AND ( stock.node_uid <> stock.mirror_node_uid\n
OR stock.section_uid <> stock.mirror_section_uid\n OR stock.section_uid <> stock.mirror_section_uid\n
OR stock.mirror_node_uid IS NULL\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>\n
\n \n
<dtml-if input_simulation_state>\n <dtml-if input_simulation_state>\n
...@@ -873,14 +877,16 @@ WHERE\n ...@@ -873,14 +877,16 @@ WHERE\n
AND ( stock.node_uid <> stock.mirror_node_uid\n AND ( stock.node_uid <> stock.mirror_node_uid\n
OR stock.section_uid <> stock.mirror_section_uid\n OR stock.section_uid <> stock.mirror_section_uid\n
OR stock.mirror_node_uid IS NULL\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>\n
<dtml-if omit_output>\n <dtml-if omit_output>\n
AND stock.quantity > 0\n AND stock.quantity > 0\n
AND ( stock.node_uid <> stock.mirror_node_uid\n AND ( stock.node_uid <> stock.mirror_node_uid\n
OR stock.section_uid <> stock.mirror_section_uid\n OR stock.section_uid <> stock.mirror_section_uid\n
OR stock.mirror_node_uid IS NULL\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>\n
\n \n
<dtml-if input_simulation_state>\n <dtml-if input_simulation_state>\n
......
...@@ -158,22 +158,22 @@ ...@@ -158,22 +158,22 @@
<key> <string>_keys</string> </key> <key> <string>_keys</string> </key>
<value> <value>
<list> <list>
<string>query</string> <string>query</string>
<string>resource_uid</string> <string>resource_uid</string>
<string>from_date</string> <string>from_date</string>
<string>at_date</string> <string>at_date</string>
<string>to_date</string> <string>to_date</string>
<string>omit_simulation</string> <string>omit_simulation</string>
<string>omit_input</string> <string>omit_input</string>
<string>omit_output</string> <string>omit_output</string>
<string>simulation_state</string> <string>simulation_state</string>
<string>section_category</string> <string>section_category</string>
<string>selection_domain</string> <string>selection_domain</string>
<string>selection_report</string> <string>selection_report</string>
<string>closed_summary</string> <string>closed_summary</string>
<string>where_expression</string> <string>where_expression</string>
<string>from_table_list</string> <string>from_table_list</string>
<string>selection_uids</string> <string>selection_uids</string>
</list> </list>
</value> </value>
</item> </item>
...@@ -306,6 +306,7 @@ WHERE\n ...@@ -306,6 +306,7 @@ WHERE\n
OR stock.section_uid <> stock.mirror_section_uid\n OR stock.section_uid <> stock.mirror_section_uid\n
OR stock.mirror_node_uid IS NULL\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
)\n )\n
</dtml-if>\n </dtml-if>\n
<dtml-if omit_output>\n <dtml-if omit_output>\n
...@@ -314,6 +315,7 @@ WHERE\n ...@@ -314,6 +315,7 @@ WHERE\n
OR stock.section_uid <> stock.mirror_section_uid\n OR stock.section_uid <> stock.mirror_section_uid\n
OR stock.mirror_node_uid IS NULL\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
)\n )\n
</dtml-if>\n </dtml-if>\n
<dtml-if simulation_state>\n <dtml-if simulation_state>\n
...@@ -449,6 +451,7 @@ WHERE\n ...@@ -449,6 +451,7 @@ WHERE\n
OR stock.section_uid <> stock.mirror_section_uid\n OR stock.section_uid <> stock.mirror_section_uid\n
OR stock.mirror_node_uid IS NULL\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
)\n )\n
</dtml-if>\n </dtml-if>\n
<dtml-if omit_output>\n <dtml-if omit_output>\n
...@@ -457,6 +460,7 @@ WHERE\n ...@@ -457,6 +460,7 @@ WHERE\n
OR stock.section_uid <> stock.mirror_section_uid\n OR stock.section_uid <> stock.mirror_section_uid\n
OR stock.mirror_node_uid IS NULL\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
)\n )\n
</dtml-if>\n </dtml-if>\n
<dtml-if simulation_state>\n <dtml-if simulation_state>\n
......
279 280
\ No newline at end of file \ No newline at end of file
...@@ -88,11 +88,15 @@ class InventoryAPITestCase(ERP5TypeTestCase): ...@@ -88,11 +88,15 @@ class InventoryAPITestCase(ERP5TypeTestCase):
self.folder = self.portal.testing_folder self.folder = self.portal.testing_folder
self.section = self._makeOrganisation(title='Section') self.section = self._makeOrganisation(title='Section')
self.other_section = self._makeOrganisation(title='Other Section')
self.node = self._makeOrganisation(title='Node') self.node = self._makeOrganisation(title='Node')
self.other_node = self._makeOrganisation(title='Other Node') self.other_node = self._makeOrganisation(title='Other Node')
self.payment_node = self.section.newContent( self.payment_node = self.section.newContent(
title='Payment Node', title='Payment Node',
portal_type='Bank Account') 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_section = self._makeOrganisation(title='Mirror Section')
self.mirror_node = self._makeOrganisation(title='Mirror Node') self.mirror_node = self._makeOrganisation(title='Mirror Node')
self.resource = self.getCurrencyModule().newContent( self.resource = self.getCurrencyModule().newContent(
...@@ -509,6 +513,93 @@ class TestInventory(InventoryAPITestCase): ...@@ -509,6 +513,93 @@ class TestInventory(InventoryAPITestCase):
self.assertEquals(0, getInventoryAssetPrice(precision=2, self.assertEquals(0, getInventoryAssetPrice(precision=2,
node_uid=self.node.getUid())) 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): class TestInventoryList(InventoryAPITestCase):
"""Tests getInventoryList methods. """Tests getInventoryList methods.
...@@ -601,6 +692,53 @@ class TestInventoryList(InventoryAPITestCase): ...@@ -601,6 +692,53 @@ class TestInventoryList(InventoryAPITestCase):
self.assertEquals([r for r in inventory_list if r.payment_uid == self.assertEquals([r for r in inventory_list if r.payment_uid ==
self.payment_node.getUid()][0].inventory, 200) 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): class TestMovementHistoryList(InventoryAPITestCase):
...@@ -1107,11 +1245,60 @@ class TestMovementHistoryList(InventoryAPITestCase): ...@@ -1107,11 +1245,60 @@ class TestMovementHistoryList(InventoryAPITestCase):
self.assertEquals(0, mvt_history_list[-1].running_total_quantity) self.assertEquals(0, mvt_history_list[-1].running_total_quantity)
self.assertEquals(0, mvt_history_list[-1].running_total_price) 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): class TestInventoryStat(InventoryAPITestCase):
"""Tests Inventory Stat methods. """Tests Inventory Stat methods.
""" """
# TODO
if __name__ == '__main__': if __name__ == '__main__':
framework() framework()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment