Commit 9cc5cfd1 authored by Jérome Perrin's avatar Jérome Perrin

I was wrong, we never wanted to drop omit_simulation support.

Add tests for omit_simulation



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@9784 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6b696094
...@@ -27,8 +27,6 @@ ...@@ -27,8 +27,6 @@
# #
############################################################################## ##############################################################################
from warnings import warn
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
...@@ -48,8 +46,6 @@ from DateTime import DateTime ...@@ -48,8 +46,6 @@ from DateTime import DateTime
from Products.ERP5 import DeliverySolver from Products.ERP5 import DeliverySolver
from Products.ERP5 import TargetSolver from Products.ERP5 import TargetSolver
_marker_for_depreacated_argument = []
class SimulationTool (BaseTool): class SimulationTool (BaseTool):
""" """
The SimulationTool implements the ERP5 The SimulationTool implements the ERP5
...@@ -462,8 +458,7 @@ class SimulationTool (BaseTool): ...@@ -462,8 +458,7 @@ class SimulationTool (BaseTool):
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getInventory') 'getInventory')
def getInventory(self, src__=0, ignore_variation=0, standardise=0, def getInventory(self, src__=0, ignore_variation=0, standardise=0,
omit_simulation=_marker_for_depreacated_argument, omit_simulation=0, omit_input=0, omit_output=0,
omit_input=0, omit_output=0,
selection_domain=None, selection_report=None, **kw): selection_domain=None, selection_report=None, **kw):
""" """
Returns an inventory of a single or multiple resources on a single or multiple Returns an inventory of a single or multiple resources on a single or multiple
...@@ -518,6 +513,8 @@ class SimulationTool (BaseTool): ...@@ -518,6 +513,8 @@ class SimulationTool (BaseTool):
standardise - provide a standard quantity rather than an SKU (XXX not implemented yet) standardise - provide a standard quantity rather than an SKU (XXX not implemented yet)
omit_simulation - doesn't take into account simulation movements
omit_input omit_input
omit_output omit_output
...@@ -538,14 +535,11 @@ class SimulationTool (BaseTool): ...@@ -538,14 +535,11 @@ class SimulationTool (BaseTool):
NOTE: we may want to define a parameter so that we can select the kind of inventory NOTE: we may want to define a parameter so that we can select the kind of inventory
statistics we want to display (ex. sum, average, cost, etc.) statistics we want to display (ex. sum, average, cost, etc.)
""" """
if omit_simulation is not _marker_for_depreacated_argument:
warn('omit_simulation parameter is ignored', DeprecationWarning)
sql_kw = self._generateSQLKeywordDict(**kw) sql_kw = self._generateSQLKeywordDict(**kw)
result = self.Resource_zGetInventory( result = self.Resource_zGetInventory(
src__=src__, ignore_variation=ignore_variation, src__=src__, ignore_variation=ignore_variation,
standardise=standardise, standardise=standardise, omit_simulation=omit_simulation,
omit_input=omit_input, omit_output=omit_output, omit_input=omit_input, omit_output=omit_output,
selection_domain=selection_domain, selection_report=selection_report, selection_domain=selection_domain, selection_report=selection_report,
**sql_kw) **sql_kw)
...@@ -598,8 +592,7 @@ class SimulationTool (BaseTool): ...@@ -598,8 +592,7 @@ class SimulationTool (BaseTool):
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getInventoryList') 'getInventoryList')
def getInventoryList(self, src__=0, ignore_variation=0, standardise=0, def getInventoryList(self, src__=0, ignore_variation=0, standardise=0,
omit_simulation=_marker_for_depreacated_argument, omit_simulation=0, omit_input=0, omit_output=0,
omit_input=0, omit_output=0,
selection_domain=None, selection_report=None, **kw): selection_domain=None, selection_report=None, **kw):
""" """
Returns a list of inventories for a single or multiple Returns a list of inventories for a single or multiple
...@@ -610,13 +603,10 @@ class SimulationTool (BaseTool): ...@@ -610,13 +603,10 @@ class SimulationTool (BaseTool):
the kind of inventory statistics we want to display (ex. sum, the kind of inventory statistics we want to display (ex. sum,
average, cost, etc.) average, cost, etc.)
""" """
if omit_simulation is not _marker_for_depreacated_argument:
warn('omit_simulation parameter is ignored', DeprecationWarning)
sql_kw = self._generateSQLKeywordDict(**kw) sql_kw = self._generateSQLKeywordDict(**kw)
return self.Resource_zGetInventoryList( return self.Resource_zGetInventoryList(
src__=src__, ignore_variation=ignore_variation, src__=src__, ignore_variation=ignore_variation,
standardise=standardise, standardise=standardise, omit_simulation=omit_simulation,
omit_input=omit_input, omit_output=omit_output, omit_input=omit_input, omit_output=omit_output,
selection_domain=selection_domain, selection_domain=selection_domain,
selection_report=selection_report, **sql_kw) selection_report=selection_report, **sql_kw)
...@@ -656,8 +646,7 @@ class SimulationTool (BaseTool): ...@@ -656,8 +646,7 @@ class SimulationTool (BaseTool):
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getInventoryStat') 'getInventoryStat')
def getInventoryStat(self, src__=0, ignore_variation=0, standardise=0, def getInventoryStat(self, src__=0, ignore_variation=0, standardise=0,
omit_simulation=_marker_for_depreacated_argument, omit_simulation=0, omit_input=0, omit_output=0,
omit_input=0, omit_output=0,
selection_domain=None, selection_report=None, **kw): selection_domain=None, selection_report=None, **kw):
""" """
getInventoryStat is the pending to getInventoryList in order to getInventoryStat is the pending to getInventoryList in order to
...@@ -665,14 +654,11 @@ class SimulationTool (BaseTool): ...@@ -665,14 +654,11 @@ class SimulationTool (BaseTool):
total of inventories, number of variations, number of different total of inventories, number of variations, number of different
nodes, etc. nodes, etc.
""" """
if omit_simulation is not _marker_for_depreacated_argument:
warn('omit_simulation parameter is ignored', DeprecationWarning)
kw['group_by_variation'] = 0 kw['group_by_variation'] = 0
sql_kw = self._generateSQLKeywordDict(**kw) sql_kw = self._generateSQLKeywordDict(**kw)
result = self.Resource_zGetInventory( result = self.Resource_zGetInventory(
src__=src__, ignore_variation=ignore_variation, src__=src__, ignore_variation=ignore_variation,
standardise=standardise, standardise=standardise, omit_simulation=omit_simulation,
omit_input=omit_input, omit_output=omit_output, omit_input=omit_input, omit_output=omit_output,
selection_domain=selection_domain, selection_domain=selection_domain,
selection_report=selection_report, **sql_kw) selection_report=selection_report, **sql_kw)
...@@ -751,9 +737,7 @@ class SimulationTool (BaseTool): ...@@ -751,9 +737,7 @@ class SimulationTool (BaseTool):
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getInventoryAssetPrice') 'getInventoryAssetPrice')
def getInventoryAssetPrice(self, src__=0, ignore_variation=0, def getInventoryAssetPrice(self, src__=0, ignore_variation=0,
standardise=0, standardise=0, omit_simulation=0, omit_input=0,
omit_simulation=_marker_for_depreacated_argument,
omit_input=0,
omit_output=0, selection_domain=None, omit_output=0, selection_domain=None,
selection_report=None, **kw): selection_report=None, **kw):
""" """
...@@ -761,13 +745,10 @@ class SimulationTool (BaseTool): ...@@ -761,13 +745,10 @@ class SimulationTool (BaseTool):
price rather than an inventory. price rather than an inventory.
""" """
if omit_simulation is not _marker_for_depreacated_argument:
warn('omit_simulation parameter is ignored', DeprecationWarning)
sql_kw = self._generateSQLKeywordDict(**kw) sql_kw = self._generateSQLKeywordDict(**kw)
result = self.Resource_zGetInventory( result = self.Resource_zGetInventory(
src__=src__, ignore_variation=ignore_variation, src__=src__, ignore_variation=ignore_variation,
standardise=standardise, standardise=standardise, omit_simulation=omit_simulation,
omit_input=omit_input, omit_output=omit_output, omit_input=omit_input, omit_output=omit_output,
selection_domain=selection_domain, selection_report=selection_report, selection_domain=selection_domain, selection_report=selection_report,
**sql_kw) **sql_kw)
...@@ -818,9 +799,7 @@ class SimulationTool (BaseTool): ...@@ -818,9 +799,7 @@ class SimulationTool (BaseTool):
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getInventoryHistoryList') 'getInventoryHistoryList')
def getInventoryHistoryList(self, src__=0, ignore_variation=0, def getInventoryHistoryList(self, src__=0, ignore_variation=0,
standardise=0, standardise=0, omit_simulation=0, omit_input=0,
omit_simulation=_marker_for_depreacated_argument,
omit_input=0,
omit_output=0, selection_domain=None, omit_output=0, selection_domain=None,
selection_report=None, **kw): selection_report=None, **kw):
""" """
...@@ -828,13 +807,10 @@ class SimulationTool (BaseTool): ...@@ -828,13 +807,10 @@ class SimulationTool (BaseTool):
for a single or a group of resource, node, section, etc. This is useful for a single or a group of resource, node, section, etc. This is useful
to list the evolution with time of inventory values (quantity, asset price). to list the evolution with time of inventory values (quantity, asset price).
""" """
if omit_simulation is not _marker_for_depreacated_argument:
warn('omit_simulation parameter is ignored', DeprecationWarning)
sql_kw = self._generateSQLKeywordDict(**kw) sql_kw = self._generateSQLKeywordDict(**kw)
return self.Resource_getInventoryHistoryList( return self.Resource_getInventoryHistoryList(
src__=src__, ignore_variation=ignore_variation, src__=src__, ignore_variation=ignore_variation,
standardise=standardise, standardise=standardise, omit_simulation=omit_simulation,
omit_input=omit_input, omit_output=omit_output, omit_input=omit_input, omit_output=omit_output,
selection_domain=selection_domain, selection_domain=selection_domain,
selection_report=selection_report, **sql_kw) selection_report=selection_report, **sql_kw)
...@@ -842,8 +818,7 @@ class SimulationTool (BaseTool): ...@@ -842,8 +818,7 @@ class SimulationTool (BaseTool):
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getInventoryHistoryChart') 'getInventoryHistoryChart')
def getInventoryHistoryChart(self, src__=0, ignore_variation=0, def getInventoryHistoryChart(self, src__=0, ignore_variation=0,
standardise=0, standardise=0, omit_simulation=0,
omit_simulation=_marker_for_depreacated_argument,
omit_input=0, omit_output=0, omit_input=0, omit_output=0,
selection_domain=None, selection_domain=None,
selection_report=None, **kw): selection_report=None, **kw):
...@@ -854,14 +829,11 @@ class SimulationTool (BaseTool): ...@@ -854,14 +829,11 @@ class SimulationTool (BaseTool):
time, value and "colour" (multiple graphs can be drawn for example time, value and "colour" (multiple graphs can be drawn for example
for each variation of a resource) for each variation of a resource)
""" """
if omit_simulation is not _marker_for_depreacated_argument:
warn('omit_simulation parameter is ignored', DeprecationWarning)
sql_kw = self._generateSQLKeywordDict(**kw) sql_kw = self._generateSQLKeywordDict(**kw)
return self.Resource_getInventoryHistoryChart( return self.Resource_getInventoryHistoryChart(
src__=src__, ignore_variation=ignore_variation, src__=src__, ignore_variation=ignore_variation,
standardise=standardise, standardise=standardise, omit_simulation=omit_simulation,
omit_input=omit_input, omit_output=omit_output, omit_input=omit_input, omit_output=omit_output,
selection_domain=selection_domain, selection_domain=selection_domain,
selection_report=selection_report, **sql_kw) selection_report=selection_report, **sql_kw)
...@@ -869,8 +841,7 @@ class SimulationTool (BaseTool): ...@@ -869,8 +841,7 @@ class SimulationTool (BaseTool):
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getMovementHistoryList') 'getMovementHistoryList')
def getMovementHistoryList(self, src__=0, ignore_variation=0, def getMovementHistoryList(self, src__=0, ignore_variation=0,
standardise=0, standardise=0, omit_simulation=0,
omit_simulation=_marker_for_depreacated_argument,
omit_input=0, omit_output=0, omit_input=0, omit_output=0,
selection_domain=None, selection_report=None, selection_domain=None, selection_report=None,
**kw): **kw):
...@@ -878,13 +849,11 @@ class SimulationTool (BaseTool): ...@@ -878,13 +849,11 @@ class SimulationTool (BaseTool):
Returns a list of movements which modify the inventory Returns a list of movements which modify the inventory
for a single or a group of resource, node, section, etc. for a single or a group of resource, node, section, etc.
""" """
if omit_simulation is not _marker_for_depreacated_argument:
warn('omit_simulation parameter is ignored', DeprecationWarning)
sql_kw = self._generateSQLKeywordDict(**kw) sql_kw = self._generateSQLKeywordDict(**kw)
return self.Resource_zGetMovementHistoryList( return self.Resource_zGetMovementHistoryList(
src__=src__, ignore_variation=ignore_variation, src__=src__, ignore_variation=ignore_variation,
standardise=standardise, standardise=standardise,
omit_simulation=omit_simulation,
omit_input=omit_input, omit_output=omit_output, omit_input=omit_input, omit_output=omit_output,
selection_domain=selection_domain, selection_domain=selection_domain,
selection_report=selection_report, **sql_kw) selection_report=selection_report, **sql_kw)
...@@ -892,48 +861,35 @@ class SimulationTool (BaseTool): ...@@ -892,48 +861,35 @@ class SimulationTool (BaseTool):
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getMovementHistoryStat') 'getMovementHistoryStat')
def getMovementHistoryStat(self, src__=0, ignore_variation=0, def getMovementHistoryStat(self, src__=0, ignore_variation=0,
standardise=0, standardise=0, omit_simulation=0, omit_input=0,
omit_simulation=_marker_for_depreacated_argument,
omit_input=0,
omit_output=0, selection_domain=None, omit_output=0, selection_domain=None,
selection_report=None, **kw): selection_report=None, **kw):
""" """
getMovementHistoryStat is the pending to getMovementHistoryList getMovementHistoryStat is the pending to getMovementHistoryList
for ListBox stat for ListBox stat
""" """
if omit_simulation is not _marker_for_depreacated_argument:
warn('omit_simulation parameter is ignored', DeprecationWarning)
sql_kw = self._generateSQLKeywordDict(**kw) sql_kw = self._generateSQLKeywordDict(**kw)
return self.Resource_zGetInventory(src__=src__, return self.Resource_zGetInventory(src__=src__,
ignore_variation=ignore_variation, standardise=standardise, ignore_variation=ignore_variation, standardise=standardise,
omit_input=omit_input, omit_simulation=omit_simulation, omit_input=omit_input,
omit_output=omit_output, selection_domain=selection_domain, omit_output=omit_output, selection_domain=selection_domain,
selection_report=selection_report, **sql_kw) selection_report=selection_report, **sql_kw)
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation, 'getNextNegativeInventoryDate')
'getNextNegativeInventoryDate')
def getNextNegativeInventoryDate(self, src__=0, def getNextNegativeInventoryDate(self, src__=0,
ignore_variation=0, standardise=0, ignore_variation=0, standardise=0, omit_simulation=0, omit_input=0, omit_output=0,
omit_simulation=_marker_for_depreacated_argument,
omit_input=0, omit_output=0,
selection_domain=None, selection_report=None, **kw): selection_domain=None, selection_report=None, **kw):
""" """
Returns statistics of inventory grouped by section or site Returns statistics of inventory grouped by section or site
""" """
if omit_simulation is not _marker_for_depreacated_argument: sql_kw = self._generateSQLKeywordDict(order_by_expression='stock.date', **kw)
warn('omit_simulation parameter is ignored', DeprecationWarning)
sql_kw = self._generateSQLKeywordDict(
order_by_expression='stock.date', **kw)
sql_kw['group_by_expression'] = 'stock.uid' sql_kw['group_by_expression'] = 'stock.uid'
sql_kw['order_by_expression'] = 'stock.date' sql_kw['order_by_expression'] = 'stock.date'
result = self.Resource_zGetInventory(src__=src__, result = self.Resource_zGetInventory(src__=src__,
ignore_variation=ignore_variation, standardise=standardise, ignore_variation=ignore_variation, standardise=standardise, omit_simulation=omit_simulation,
omit_input=omit_input, omit_output=omit_output, omit_input=omit_input, omit_output=omit_output,
selection_domain=selection_domain, selection_domain=selection_domain, selection_report=selection_report, **sql_kw)
selection_report=selection_report, **sql_kw)
if src__ : if src__ :
return result return result
...@@ -948,8 +904,7 @@ class SimulationTool (BaseTool): ...@@ -948,8 +904,7 @@ class SimulationTool (BaseTool):
####################################################### #######################################################
# Traceability management # Traceability management
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation, 'getTrackingList')
'getTrackingList')
def getTrackingList(self, src__=0, def getTrackingList(self, src__=0,
selection_domain=None, selection_report=None, selection_domain=None, selection_report=None,
strict_simulation_state=1, **kw) : strict_simulation_state=1, **kw) :
...@@ -1027,17 +982,14 @@ class SimulationTool (BaseTool): ...@@ -1027,17 +982,14 @@ class SimulationTool (BaseTool):
delivered for the last time before at_date or to_date". Cannot be used with input delivered for the last time before at_date or to_date". Cannot be used with input
""" """
new_kw = self._generateSQLKeywordDict(table='item', new_kw = self._generateSQLKeywordDict(table='item',strict_simulation_state=strict_simulation_state,**kw)
strict_simulation_state=strict_simulation_state,
**kw)
new_kw['at_date'] = kw.get('at_date') new_kw['at_date'] = kw.get('at_date')
# Extra parameters for the SQL Method # Extra parameters for the SQL Method
new_kw['join_on_item'] = new_kw.get('at_date') or \ new_kw['join_on_item'] = new_kw.get('at_date') or \
new_kw.get('input') or \ new_kw.get('input') or \
new_kw.get('output') new_kw.get('output')
new_kw['date_condition_in_join'] = not (new_kw.get('input') new_kw['date_condition_in_join'] = not (new_kw.get('input') or new_kw.get('output'))
or new_kw.get('output'))
# Pass simulation state to request # Pass simulation state to request
if kw.has_key('item.simulation_state'): if kw.has_key('item.simulation_state'):
......
...@@ -78,6 +78,12 @@ ...@@ -78,6 +78,12 @@
<dictionary/> <dictionary/>
</value> </value>
</item> </item>
<item>
<key> <string>omit_simulation</string> </key>
<value>
<dictionary/>
</value>
</item>
<item> <item>
<key> <string>order_by_expression</string> </key> <key> <string>order_by_expression</string> </key>
<value> <value>
...@@ -126,18 +132,19 @@ ...@@ -126,18 +132,19 @@
<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>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_input</string> <string>omit_simulation</string>
<string>omit_output</string> <string>omit_input</string>
<string>input_simulation_state</string> <string>omit_output</string>
<string>output_simulation_state</string> <string>input_simulation_state</string>
<string>group_by_expression</string> <string>output_simulation_state</string>
<string>group_by_expression</string>
</list> </list>
</value> </value>
</item> </item>
...@@ -167,6 +174,7 @@ selection_domain\r\n ...@@ -167,6 +174,7 @@ selection_domain\r\n
selection_report\r\n selection_report\r\n
ignore_variation\r\n ignore_variation\r\n
standardize\r\n standardize\r\n
omit_simulation\r\n
omit_input\r\n omit_input\r\n
omit_output\r\n omit_output\r\n
input_simulation_state:list\r\n input_simulation_state:list\r\n
...@@ -249,6 +257,10 @@ WHERE\n ...@@ -249,6 +257,10 @@ WHERE\n
AND node.uid = stock.node_uid\n AND node.uid = stock.node_uid\n
AND resource.uid = stock.resource_uid\n AND resource.uid = stock.resource_uid\n
\n \n
<dtml-if omit_simulation>\n
AND catalog.portal_type != \'Simulation Movement\'\n
</dtml-if>\n
\n
<dtml-if omit_input>\n <dtml-if omit_input>\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
...@@ -375,6 +387,10 @@ WHERE\n ...@@ -375,6 +387,10 @@ WHERE\n
AND node.uid = stock.node_uid\n AND node.uid = stock.node_uid\n
AND resource.uid = stock.resource_uid\n AND resource.uid = stock.resource_uid\n
\n \n
<dtml-if omit_simulation>\n
AND catalog.portal_type != \'Simulation Movement\'\n
</dtml-if>\n
\n
<dtml-if omit_input>\n <dtml-if omit_input>\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
......
...@@ -86,6 +86,12 @@ ...@@ -86,6 +86,12 @@
<dictionary/> <dictionary/>
</value> </value>
</item> </item>
<item>
<key> <string>omit_simulation</string> </key>
<value>
<dictionary/>
</value>
</item>
<item> <item>
<key> <string>order_by_expression</string> </key> <key> <string>order_by_expression</string> </key>
<value> <value>
...@@ -134,18 +140,19 @@ ...@@ -134,18 +140,19 @@
<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_input</string> <string>omit_simulation</string>
<string>omit_output</string> <string>omit_input</string>
<string>input_simulation_state</string> <string>omit_output</string>
<string>output_simulation_state</string> <string>input_simulation_state</string>
<string>output_simulation_state</string>
</list> </list>
</value> </value>
</item> </item>
...@@ -176,6 +183,7 @@ selection_domain\r\n ...@@ -176,6 +183,7 @@ selection_domain\r\n
selection_report\r\n selection_report\r\n
ignore_variation\r\n ignore_variation\r\n
standardize\r\n standardize\r\n
omit_simulation\r\n
omit_input\r\n omit_input\r\n
omit_output\r\n omit_output\r\n
input_simulation_state:list\r\n input_simulation_state:list\r\n
...@@ -258,6 +266,10 @@ WHERE\n ...@@ -258,6 +266,10 @@ WHERE\n
AND node.uid = stock.node_uid\n AND node.uid = stock.node_uid\n
AND resource.uid = stock.resource_uid\n AND resource.uid = stock.resource_uid\n
\n \n
<dtml-if omit_simulation>\n
AND catalog.portal_type != \'Simulation Movement\'\n
</dtml-if>\n
\n
<dtml-if omit_input>\n <dtml-if omit_input>\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
...@@ -391,6 +403,10 @@ WHERE\n ...@@ -391,6 +403,10 @@ WHERE\n
AND node.uid = stock.node_uid\n AND node.uid = stock.node_uid\n
AND resource.uid = stock.resource_uid\n AND resource.uid = stock.resource_uid\n
\n \n
<dtml-if omit_simulation>\n
AND catalog.portal_type != \'Simulation Movement\'\n
</dtml-if>\n
\n
<dtml-if omit_input>\n <dtml-if omit_input>\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
......
...@@ -78,6 +78,12 @@ ...@@ -78,6 +78,12 @@
<dictionary/> <dictionary/>
</value> </value>
</item> </item>
<item>
<key> <string>omit_simulation</string> </key>
<value>
<dictionary/>
</value>
</item>
<item> <item>
<key> <string>order_by_expression</string> </key> <key> <string>order_by_expression</string> </key>
<value> <value>
...@@ -126,18 +132,19 @@ ...@@ -126,18 +132,19 @@
<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_input</string> <string>omit_simulation</string>
<string>omit_output</string> <string>omit_input</string>
<string>input_simulation_state</string> <string>omit_output</string>
<string>output_simulation_state</string> <string>input_simulation_state</string>
<string>output_simulation_state</string>
</list> </list>
</value> </value>
</item> </item>
...@@ -577,6 +584,7 @@ selection_domain\r\n ...@@ -577,6 +584,7 @@ selection_domain\r\n
selection_report\r\n selection_report\r\n
ignore_variation\r\n ignore_variation\r\n
standardize\r\n standardize\r\n
omit_simulation\r\n
omit_input\r\n omit_input\r\n
omit_output\r\n omit_output\r\n
input_simulation_state:list\r\n input_simulation_state:list\r\n
...@@ -656,6 +664,10 @@ WHERE\n ...@@ -656,6 +664,10 @@ WHERE\n
AND node.uid = stock.node_uid\n AND node.uid = stock.node_uid\n
AND resource.uid = stock.resource_uid\n AND resource.uid = stock.resource_uid\n
\n \n
<dtml-if omit_simulation>\n
AND catalog.portal_type != \'Simulation Movement\'\n
</dtml-if>\n
\n
<dtml-if omit_input>\n <dtml-if omit_input>\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
...@@ -786,6 +798,10 @@ WHERE\n ...@@ -786,6 +798,10 @@ WHERE\n
AND node.uid = stock.node_uid\n AND node.uid = stock.node_uid\n
AND resource.uid = stock.resource_uid\n AND resource.uid = stock.resource_uid\n
\n \n
<dtml-if omit_simulation>\n
AND catalog.portal_type != \'Simulation Movement\'\n
</dtml-if>\n
\n
<dtml-if omit_input>\n <dtml-if omit_input>\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
......
...@@ -76,6 +76,12 @@ ...@@ -76,6 +76,12 @@
<dictionary/> <dictionary/>
</value> </value>
</item> </item>
<item>
<key> <string>omit_simulation</string> </key>
<value>
<dictionary/>
</value>
</item>
<item> <item>
<key> <string>query</string> </key> <key> <string>query</string> </key>
<value> <value>
...@@ -152,21 +158,22 @@ ...@@ -152,21 +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_input</string> <string>omit_simulation</string>
<string>omit_output</string> <string>omit_input</string>
<string>simulation_state</string> <string>omit_output</string>
<string>section_category</string> <string>simulation_state</string>
<string>selection_domain</string> <string>section_category</string>
<string>selection_report</string> <string>selection_domain</string>
<string>closed_summary</string> <string>selection_report</string>
<string>where_expression</string> <string>closed_summary</string>
<string>from_table_list</string> <string>where_expression</string>
<string>selection_uids</string> <string>from_table_list</string>
<string>selection_uids</string>
</list> </list>
</value> </value>
</item> </item>
...@@ -194,6 +201,7 @@ resource_uid:list\r\n ...@@ -194,6 +201,7 @@ resource_uid:list\r\n
from_date\r\n from_date\r\n
at_date\r\n at_date\r\n
to_date\r\n to_date\r\n
omit_simulation\r\n
omit_input\r\n omit_input\r\n
omit_output\r\n omit_output\r\n
simulation_state:list\r\n simulation_state:list\r\n
...@@ -295,6 +303,9 @@ WHERE\n ...@@ -295,6 +303,9 @@ WHERE\n
<dtml-if to_date>\n <dtml-if to_date>\n
AND stock.date < <dtml-sqlvar to_date type="datetime">\n AND stock.date < <dtml-sqlvar to_date type="datetime">\n
</dtml-if>\n </dtml-if>\n
<dtml-if omit_simulation>\n
AND catalog.portal_type != \'Simulation Movement\'\n
</dtml-if>\n
<dtml-if omit_input>\n <dtml-if omit_input>\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
...@@ -435,6 +446,9 @@ WHERE\n ...@@ -435,6 +446,9 @@ WHERE\n
<dtml-if to_date>\n <dtml-if to_date>\n
AND stock.date < <dtml-sqlvar to_date type="datetime">\n AND stock.date < <dtml-sqlvar to_date type="datetime">\n
</dtml-if>\n </dtml-if>\n
<dtml-if omit_simulation>\n
AND catalog.portal_type != \'Simulation Movement\'\n
</dtml-if>\n
<dtml-if omit_input>\n <dtml-if omit_input>\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
......
2006-09-04 jerome
* remove omit_simulation parameter in all inventory API ZSQLMethods.
2006-08-25 Stefan 2006-08-25 Stefan
* Update naming convention script. * Update naming convention script.
......
55 56
\ No newline at end of file \ No newline at end of file
...@@ -270,6 +270,15 @@ class TestInventory(InventoryAPITestCase): ...@@ -270,6 +270,15 @@ class TestInventory(InventoryAPITestCase):
# not accountable movement are not counted by getInventory # not accountable movement are not counted by getInventory
get_transaction().commit(); self.tic() # (after reindexing of course) get_transaction().commit(); self.tic() # (after reindexing of course)
self.assertEquals(100, getInventory(section_uid=self.section.getUid())) self.assertEquals(100, getInventory(section_uid=self.section.getUid()))
def test_OmitSimulation(self, quiet=0, run=RUN_ALL_TESTS):
"""Test omit_simulation argument to getInventory.
"""
getInventory = self.getSimulationTool().getInventory
self._makeSimulationMovement(quantity=100)
self._makeMovement(quantity=100)
self.assertEquals(100, getInventory(section_uid=self.section.getUid(),
omit_simulation=1))
def test_SectionCategory(self, quiet=0, run=RUN_ALL_TESTS): def test_SectionCategory(self, quiet=0, run=RUN_ALL_TESTS):
"""Tests inventory on section category. """ """Tests inventory on section category. """
...@@ -819,7 +828,28 @@ class TestMovementHistoryList(InventoryAPITestCase): ...@@ -819,7 +828,28 @@ class TestMovementHistoryList(InventoryAPITestCase):
section_uid=self.section.getUid()) section_uid=self.section.getUid())
self.assertEquals(len(movement_history_list), 2) self.assertEquals(len(movement_history_list), 2)
def test_SimulationMovement(self, quiet=0, run=RUN_ALL_TESTS):
"""Test simulation movement are listed in getMovementHistoryList
"""
getMovementHistoryList = self.getSimulationTool().getMovementHistoryList
self._makeSimulationMovement(quantity=100)
self._makeMovement(quantity=100)
movement_history_list = getMovementHistoryList(
section_uid=self.section.getUid())
self.assertEquals(2, len(movement_history_list))
def test_OmitSimulation(self, quiet=0, run=RUN_ALL_TESTS):
"""Test omit_simulation argument to getMovementHistoryList.
"""
getMovementHistoryList = self.getSimulationTool().getMovementHistoryList
self._makeSimulationMovement(quantity=100)
self._makeMovement(quantity=100)
movement_history_list = getMovementHistoryList(
section_uid=self.section.getUid(),
omit_simulation=1)
self.assertEquals(1, len(movement_history_list))
self.assertEquals(100, movement_history_list[0].quantity)
class TestInventoryStat(InventoryAPITestCase): class TestInventoryStat(InventoryAPITestCase):
"""Tests Inventory Stat methods. """Tests Inventory Stat methods.
""" """
......
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