From e36ae57b64c9a04229735bd87c949b0d6fc5a05b Mon Sep 17 00:00:00 2001 From: Romain Courteaud <romain@nexedi.com> Date: Thu, 5 Jan 2006 13:17:49 +0000 Subject: [PATCH] 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 --- product/ERP5/Tool/SimulationTool.py | 87 ++++++++++++++++------------- 1 file changed, 48 insertions(+), 39 deletions(-) diff --git a/product/ERP5/Tool/SimulationTool.py b/product/ERP5/Tool/SimulationTool.py index 573f04f62d..3b1d79a8c0 100755 --- a/product/ERP5/Tool/SimulationTool.py +++ b/product/ERP5/Tool/SimulationTool.py @@ -511,28 +511,26 @@ class SimulationTool (BaseTool): list(self.getPortalCurrentInventoryStateList())) return self.getInventoryList(**kw) - security.declareProtected(Permissions.AccessContentsInformation, 'getInventoryStat') - def getInventoryStat(self, src__=0, - ignore_variation=0, standardise=0, omit_simulation=0, omit_input=0, omit_output=0, - selection_domain=None, selection_report=None, **kw) : + security.declareProtected(Permissions.AccessContentsInformation, + 'getInventoryStat') + def getInventoryStat(self, src__=0, ignore_variation=0, standardise=0, + 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 - statistics on getInventoryList lines in ListBox such as: total of inventories, - number of variations, number of different nodes, etc. + getInventoryStat is the pending to getInventoryList in order to + provide statistics on getInventoryList lines in ListBox such as: + total of inventories, number of variations, number of different + nodes, etc. """ + kw['group_by_variation'] = 0 sql_kw = self._generateSQLKeywordDict(**kw) - - result = self.Resource_zGetInventory(src__=src__, - ignore_variation=ignore_variation, standardise=standardise, omit_simulation=omit_simulation, + result = self.Resource_zGetInventory( + src__=src__, ignore_variation=ignore_variation, + standardise=standardise, omit_simulation=omit_simulation, omit_input=omit_input, omit_output=omit_output, - selection_domain=selection_domain, selection_report=selection_report, **sql_kw) - if src__ : - return result - - total_result = 0 - for row in result : - total_result += row.stock_uid - return total_result + selection_domain=selection_domain, + selection_report=selection_report, **sql_kw) + return result security.declareProtected(Permissions.AccessContentsInformation, 'getCurrentInventoryStat') def getCurrentInventoryStat(self, **kw): @@ -542,13 +540,16 @@ class SimulationTool (BaseTool): kw['simulation_state'] = self.getPortalCurrentInventoryStateList() return self.getInventoryStat(**kw) - security.declareProtected(Permissions.AccessContentsInformation, 'getFutureInventoryStat') + security.declareProtected(Permissions.AccessContentsInformation, + 'getFutureInventoryStat') def getFutureInventoryStat(self, **kw): """ Returns statistics of future inventory grouped by section or site """ - kw['simulation_state'] = tuple(list(self.getPortalFutureInventoryStateList()) - + list(self.getPortalReservedInventoryStateList()) + list(self.getPortalCurrentInventoryStateList())) + kw['simulation_state'] = tuple( + list(self.getPortalFutureInventoryStateList()) + \ + list(self.getPortalReservedInventoryStateList()) + \ + list(self.getPortalCurrentInventoryStateList())) return self.getInventoryStat(**kw) security.declareProtected(Permissions.AccessContentsInformation, 'getInventoryChart') @@ -660,34 +661,42 @@ class SimulationTool (BaseTool): omit_input=omit_input, omit_output=omit_output, selection_domain=selection_domain, selection_report=selection_report, **sql_kw) - security.declareProtected(Permissions.AccessContentsInformation, 'getMovementHistoryList') - def getMovementHistoryList(self, src__=0, - ignore_variation=0, standardise=0, omit_simulation=0, omit_input=0, omit_output=0, - selection_domain=None, selection_report=None, **kw): + security.declareProtected(Permissions.AccessContentsInformation, + 'getMovementHistoryList') + def getMovementHistoryList(self, src__=0, ignore_variation=0, + 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 for a single or a group of resource, node, section, etc. """ sql_kw = self._generateSQLKeywordDict(**kw) + return self.Resource_zGetMovementHistoryList( + src__=src__, ignore_variation=ignore_variation, + standardise=standardise, + omit_simulation=omit_simulation, + omit_input=omit_input, omit_output=omit_output, + selection_domain=selection_domain, + selection_report=selection_report, **sql_kw) - return self.Resource_zGetMovementHistoryList(src__=src__, - ignore_variation=ignore_variation, standardise=standardise, omit_simulation=omit_simulation, - omit_input=omit_input, omit_output=omit_output, - selection_domain=selection_domain, selection_report=selection_report, **sql_kw) - - security.declareProtected(Permissions.AccessContentsInformation, 'getMovementHistoryStat') - def getMovementHistoryStat(self, src__=0, - ignore_variation=0, standardise=0, omit_simulation=0, omit_input=0, omit_output=0, - selection_domain=None, selection_report=None, **kw): + security.declareProtected(Permissions.AccessContentsInformation, + 'getMovementHistoryStat') + def getMovementHistoryStat(self, src__=0, ignore_variation=0, + 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) - return self.Resource_zGetInventory(src__=src__, - ignore_variation=ignore_variation, standardise=standardise, omit_simulation=omit_simulation, - omit_input=omit_input, omit_output=omit_output, - selection_domain=selection_domain, selection_report=selection_report, **sql_kw) + ignore_variation=ignore_variation, standardise=standardise, + omit_simulation=omit_simulation, omit_input=omit_input, + omit_output=omit_output, selection_domain=selection_domain, + selection_report=selection_report, **sql_kw) security.declareProtected(Permissions.AccessContentsInformation, 'getNextNegativeInventoryDate') def getNextNegativeInventoryDate(self, src__=0, -- 2.30.9