Commit e36ae57b authored by Romain Courteaud's avatar Romain Courteaud

Changed code layout.

Fixed getInventoryStat (do not group by variation, reject patch 2.56).


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5030 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 74ec3a70
...@@ -511,29 +511,27 @@ class SimulationTool (BaseTool): ...@@ -511,29 +511,27 @@ class SimulationTool (BaseTool):
list(self.getPortalCurrentInventoryStateList())) list(self.getPortalCurrentInventoryStateList()))
return self.getInventoryList(**kw) return self.getInventoryList(**kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getInventoryStat') security.declareProtected(Permissions.AccessContentsInformation,
def getInventoryStat(self, src__=0, 'getInventoryStat')
ignore_variation=0, standardise=0, omit_simulation=0, omit_input=0, omit_output=0, def getInventoryStat(self, src__=0, ignore_variation=0, standardise=0,
selection_domain=None, selection_report=None, **kw) : omit_simulation=0, omit_input=0, omit_output=0,
selection_domain=None, selection_report=None, **kw):
""" """
getInventoryStat is the pending to getInventoryList in order to provide getInventoryStat is the pending to getInventoryList in order to
statistics on getInventoryList lines in ListBox such as: total of inventories, provide statistics on getInventoryList lines in ListBox such as:
number of variations, number of different nodes, etc. total of inventories, number of variations, number of different
nodes, etc.
""" """
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__, src__=src__, ignore_variation=ignore_variation,
ignore_variation=ignore_variation, standardise=standardise, omit_simulation=omit_simulation, 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, **sql_kw) selection_domain=selection_domain,
if src__ : selection_report=selection_report, **sql_kw)
return result return result
total_result = 0
for row in result :
total_result += row.stock_uid
return total_result
security.declareProtected(Permissions.AccessContentsInformation, 'getCurrentInventoryStat') security.declareProtected(Permissions.AccessContentsInformation, 'getCurrentInventoryStat')
def getCurrentInventoryStat(self, **kw): def getCurrentInventoryStat(self, **kw):
""" """
...@@ -542,13 +540,16 @@ class SimulationTool (BaseTool): ...@@ -542,13 +540,16 @@ class SimulationTool (BaseTool):
kw['simulation_state'] = self.getPortalCurrentInventoryStateList() kw['simulation_state'] = self.getPortalCurrentInventoryStateList()
return self.getInventoryStat(**kw) return self.getInventoryStat(**kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getFutureInventoryStat') security.declareProtected(Permissions.AccessContentsInformation,
'getFutureInventoryStat')
def getFutureInventoryStat(self, **kw): def getFutureInventoryStat(self, **kw):
""" """
Returns statistics of future inventory grouped by section or site Returns statistics of future inventory grouped by section or site
""" """
kw['simulation_state'] = tuple(list(self.getPortalFutureInventoryStateList()) kw['simulation_state'] = tuple(
+ list(self.getPortalReservedInventoryStateList()) + list(self.getPortalCurrentInventoryStateList())) list(self.getPortalFutureInventoryStateList()) + \
list(self.getPortalReservedInventoryStateList()) + \
list(self.getPortalCurrentInventoryStateList()))
return self.getInventoryStat(**kw) return self.getInventoryStat(**kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getInventoryChart') security.declareProtected(Permissions.AccessContentsInformation, 'getInventoryChart')
...@@ -660,34 +661,42 @@ class SimulationTool (BaseTool): ...@@ -660,34 +661,42 @@ class SimulationTool (BaseTool):
omit_input=omit_input, omit_output=omit_output, omit_input=omit_input, omit_output=omit_output,
selection_domain=selection_domain, selection_report=selection_report, **sql_kw) selection_domain=selection_domain, selection_report=selection_report, **sql_kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getMovementHistoryList') security.declareProtected(Permissions.AccessContentsInformation,
def getMovementHistoryList(self, src__=0, 'getMovementHistoryList')
ignore_variation=0, standardise=0, omit_simulation=0, omit_input=0, omit_output=0, def getMovementHistoryList(self, src__=0, ignore_variation=0,
selection_domain=None, selection_report=None, **kw): standardise=0, omit_simulation=0,
omit_input=0, omit_output=0,
selection_domain=None, selection_report=None,
**kw):
""" """
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.
""" """
sql_kw = self._generateSQLKeywordDict(**kw) sql_kw = self._generateSQLKeywordDict(**kw)
return self.Resource_zGetMovementHistoryList(
return self.Resource_zGetMovementHistoryList(src__=src__, src__=src__, ignore_variation=ignore_variation,
ignore_variation=ignore_variation, standardise=standardise, omit_simulation=omit_simulation, 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, **sql_kw) selection_domain=selection_domain,
selection_report=selection_report, **sql_kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getMovementHistoryStat') security.declareProtected(Permissions.AccessContentsInformation,
def getMovementHistoryStat(self, src__=0, 'getMovementHistoryStat')
ignore_variation=0, standardise=0, omit_simulation=0, omit_input=0, omit_output=0, def getMovementHistoryStat(self, src__=0, ignore_variation=0,
selection_domain=None, selection_report=None, **kw): standardise=0, omit_simulation=0, omit_input=0,
omit_output=0, selection_domain=None,
selection_report=None, **kw):
""" """
getMovementHistoryStat is the pending to getMovementHistoryList for ListBox stat getMovementHistoryStat is the pending to getMovementHistoryList
for ListBox stat
""" """
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, omit_simulation=omit_simulation, ignore_variation=ignore_variation, standardise=standardise,
omit_input=omit_input, omit_output=omit_output, omit_simulation=omit_simulation, omit_input=omit_input,
selection_domain=selection_domain, selection_report=selection_report, **sql_kw) omit_output=omit_output, selection_domain=selection_domain,
selection_report=selection_report, **sql_kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getNextNegativeInventoryDate') security.declareProtected(Permissions.AccessContentsInformation, 'getNextNegativeInventoryDate')
def getNextNegativeInventoryDate(self, src__=0, def getNextNegativeInventoryDate(self, src__=0,
......
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