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

Added getAvailableInventoryList, getAvailableInventoryStat;

pass uid and not relative_url to SimulationTool methods;
use getToolByName to get SimulationTool from it's original context



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6762 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8494dc95
...@@ -272,8 +272,9 @@ class Resource(XMLMatrix, CoreResource, Variated): ...@@ -272,8 +272,9 @@ class Resource(XMLMatrix, CoreResource, Variated):
""" """
Returns inventory Returns inventory
""" """
kw['resource'] = self.getRelativeUrl() kw['resource_uid'] = self.getUid()
return self.portal_simulation.getInventory(**kw) portal_simulation = getToolByName(self, 'portal_simulation')
return portal_simulation.getInventory(**kw)
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getCurrentInventory') 'getCurrentInventory')
...@@ -281,8 +282,9 @@ class Resource(XMLMatrix, CoreResource, Variated): ...@@ -281,8 +282,9 @@ class Resource(XMLMatrix, CoreResource, Variated):
""" """
Returns current inventory Returns current inventory
""" """
kw['resource'] = self.getRelativeUrl() kw['resource_uid'] = self.getUid()
return self.portal_simulation.getCurrentInventory(**kw) portal_simulation = getToolByName(self, 'portal_simulation')
return portal_simulation.getCurrentInventory(**kw)
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getAvailableInventory') 'getAvailableInventory')
...@@ -291,8 +293,9 @@ class Resource(XMLMatrix, CoreResource, Variated): ...@@ -291,8 +293,9 @@ class Resource(XMLMatrix, CoreResource, Variated):
Returns available inventory Returns available inventory
(current inventory - deliverable) (current inventory - deliverable)
""" """
kw['resource'] = self.getRelativeUrl() kw['resource_uid'] = self.getUid()
return self.portal_simulation.getAvailableInventory(**kw) portal_simulation = getToolByName(self, 'portal_simulation')
return portal_simulation.getAvailableInventory(**kw)
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getFutureInventory') 'getFutureInventory')
...@@ -300,8 +303,9 @@ class Resource(XMLMatrix, CoreResource, Variated): ...@@ -300,8 +303,9 @@ class Resource(XMLMatrix, CoreResource, Variated):
""" """
Returns inventory at infinite Returns inventory at infinite
""" """
kw['resource'] = self.getRelativeUrl() kw['resource_uid'] = self.getUid()
return self.portal_simulation.getFutureInventory(**kw) portal_simulation = getToolByName(self, 'portal_simulation')
return portal_simulation.getFutureInventory(**kw)
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getInventoryList') 'getInventoryList')
...@@ -309,8 +313,9 @@ class Resource(XMLMatrix, CoreResource, Variated): ...@@ -309,8 +313,9 @@ class Resource(XMLMatrix, CoreResource, Variated):
""" """
Returns list of inventory grouped by section or site Returns list of inventory grouped by section or site
""" """
kw['resource'] = self.getRelativeUrl() kw['resource_uid'] = self.getUid()
return self.portal_simulation.getInventoryList(**kw) portal_simulation = getToolByName(self, 'portal_simulation')
return portal_simulation.getInventoryList(**kw)
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getCurrentInventoryList') 'getCurrentInventoryList')
...@@ -318,8 +323,19 @@ class Resource(XMLMatrix, CoreResource, Variated): ...@@ -318,8 +323,19 @@ class Resource(XMLMatrix, CoreResource, Variated):
""" """
Returns list of inventory grouped by section or site Returns list of inventory grouped by section or site
""" """
kw['resource'] = self.getRelativeUrl() kw['resource_uid'] = self.getUid()
return self.portal_simulation.getCurrentInventoryList(**kw) portal_simulation = getToolByName(self, 'portal_simulation')
return portal_simulation.getCurrentInventoryList(**kw)
security.declareProtected(Permissions.AccessContentsInformation,
'getAvailableInventoryList')
def getAvailableInventoryList(self, **kw):
"""
Returns list of inventory grouped by section or site
"""
kw['resource_uid'] = self.getUid()
portal_simulation = getToolByName(self, 'portal_simulation')
return portal_simulation.getAvailableInventoryList(**kw)
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getFutureInventoryList') 'getFutureInventoryList')
...@@ -327,8 +343,9 @@ class Resource(XMLMatrix, CoreResource, Variated): ...@@ -327,8 +343,9 @@ class Resource(XMLMatrix, CoreResource, Variated):
""" """
Returns list of inventory grouped by section or site Returns list of inventory grouped by section or site
""" """
kw['resource'] = self.getRelativeUrl() kw['resource_uid'] = self.getUid()
return self.portal_simulation.getFutureInventoryList(**kw) portal_simulation = getToolByName(self, 'portal_simulation')
return portal_simulation.getFutureInventoryList(**kw)
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getInventoryStat') 'getInventoryStat')
...@@ -336,8 +353,9 @@ class Resource(XMLMatrix, CoreResource, Variated): ...@@ -336,8 +353,9 @@ class Resource(XMLMatrix, CoreResource, Variated):
""" """
Returns statistics of inventory grouped by section or site Returns statistics of inventory grouped by section or site
""" """
kw['resource'] = self.getRelativeUrl() kw['resource_uid'] = self.getUid()
return self.portal_simulation.getInventoryStat(**kw) portal_simulation = getToolByName(self, 'portal_simulation')
return portal_simulation.getInventoryStat(**kw)
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getCurrentInventoryStat') 'getCurrentInventoryStat')
...@@ -345,8 +363,19 @@ class Resource(XMLMatrix, CoreResource, Variated): ...@@ -345,8 +363,19 @@ class Resource(XMLMatrix, CoreResource, Variated):
""" """
Returns statistics of inventory grouped by section or site Returns statistics of inventory grouped by section or site
""" """
kw['resource'] = self.getRelativeUrl() kw['resource_uid'] = self.getUid()
return self.portal_simulation.getCurrentInventoryStat(**kw) portal_simulation = getToolByName(self, 'portal_simulation')
return portal_simulation.getCurrentInventoryStat(**kw)
security.declareProtected(Permissions.AccessContentsInformation,
'getAvailableInventoryStat')
def getAvailableInventoryStat(self, **kw):
"""
Returns statistics of inventory grouped by section or site
"""
kw['resource_uid'] = self.getUid()
portal_simulation = getToolByName(self, 'portal_simulation')
return portal_simulation.getAvailableInventoryStat(**kw)
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getFutureInventoryStat') 'getFutureInventoryStat')
...@@ -354,8 +383,9 @@ class Resource(XMLMatrix, CoreResource, Variated): ...@@ -354,8 +383,9 @@ class Resource(XMLMatrix, CoreResource, Variated):
""" """
Returns statistics of inventory grouped by section or site Returns statistics of inventory grouped by section or site
""" """
kw['resource'] = self.getRelativeUrl() kw['resource_uid'] = self.getUid()
return self.portal_simulation.getFutureInventoryStat(**kw) portal_simulation = getToolByName(self, 'portal_simulation')
return portal_simulation.getFutureInventoryStat(**kw)
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getInventoryChart') 'getInventoryChart')
...@@ -363,8 +393,9 @@ class Resource(XMLMatrix, CoreResource, Variated): ...@@ -363,8 +393,9 @@ class Resource(XMLMatrix, CoreResource, Variated):
""" """
Returns list of inventory grouped by section or site Returns list of inventory grouped by section or site
""" """
kw['resource'] = self.getRelativeUrl() kw['resource_uid'] = self.getUid()
return self.portal_simulation.getInventoryChart(**kw) portal_simulation = getToolByName(self, 'portal_simulation')
return portal_simulation.getInventoryChart(**kw)
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getCurrentInventoryChart') 'getCurrentInventoryChart')
...@@ -372,8 +403,9 @@ class Resource(XMLMatrix, CoreResource, Variated): ...@@ -372,8 +403,9 @@ class Resource(XMLMatrix, CoreResource, Variated):
""" """
Returns list of inventory grouped by section or site Returns list of inventory grouped by section or site
""" """
kw['resource'] = self.getRelativeUrl() kw['resource_uid'] = self.getUid()
return self.portal_simulation.getCurrentInventoryChart(**kw) portal_simulation = getToolByName(self, 'portal_simulation')
return portal_simulation.getCurrentInventoryChart(**kw)
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getFutureInventoryChart') 'getFutureInventoryChart')
...@@ -381,8 +413,9 @@ class Resource(XMLMatrix, CoreResource, Variated): ...@@ -381,8 +413,9 @@ class Resource(XMLMatrix, CoreResource, Variated):
""" """
Returns list of inventory grouped by section or site Returns list of inventory grouped by section or site
""" """
kw['resource'] = self.getRelativeUrl() kw['resource_uid'] = self.getUid()
return self.portal_simulation.getFutureInventoryChart(**kw) portal_simulation = getToolByName(self, 'portal_simulation')
return portal_simulation.getFutureInventoryChart(**kw)
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getInventoryHistoryList') 'getInventoryHistoryList')
...@@ -390,8 +423,9 @@ class Resource(XMLMatrix, CoreResource, Variated): ...@@ -390,8 +423,9 @@ class Resource(XMLMatrix, CoreResource, Variated):
""" """
Returns list of inventory grouped by section or site Returns list of inventory grouped by section or site
""" """
kw['resource'] = self.getRelativeUrl() kw['resource_uid'] = self.getUid()
return self.portal_simulation.getInventoryHistoryList(**kw) portal_simulation = getToolByName(self, 'portal_simulation')
return portal_simulation.getInventoryHistoryList(**kw)
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getInventoryHistoryChart') 'getInventoryHistoryChart')
...@@ -399,8 +433,9 @@ class Resource(XMLMatrix, CoreResource, Variated): ...@@ -399,8 +433,9 @@ class Resource(XMLMatrix, CoreResource, Variated):
""" """
Returns list of inventory grouped by section or site Returns list of inventory grouped by section or site
""" """
kw['resource'] = self.getRelativeUrl() kw['resource_uid'] = self.getUid()
return self.portal_simulation.getInventoryHistoryChart(**kw) portal_simulation = getToolByName(self, 'portal_simulation')
return portal_simulation.getInventoryHistoryChart(**kw)
# XXX FIXME # XXX FIXME
# Method getCurrentMovementHistoryList, # Method getCurrentMovementHistoryList,
...@@ -412,8 +447,9 @@ class Resource(XMLMatrix, CoreResource, Variated): ...@@ -412,8 +447,9 @@ class Resource(XMLMatrix, CoreResource, Variated):
""" """
Returns list of inventory grouped by section or site Returns list of inventory grouped by section or site
""" """
kw['resource'] = self.getRelativeUrl() kw['resource_uid'] = self.getUid()
return self.portal_simulation.getMovementHistoryList(**kw) portal_simulation = getToolByName(self, 'portal_simulation')
return portal_simulation.getMovementHistoryList(**kw)
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getMovementHistoryStat') 'getMovementHistoryStat')
...@@ -421,8 +457,9 @@ class Resource(XMLMatrix, CoreResource, Variated): ...@@ -421,8 +457,9 @@ class Resource(XMLMatrix, CoreResource, Variated):
""" """
Returns list of inventory grouped by section or site Returns list of inventory grouped by section or site
""" """
kw['resource'] = self.getRelativeUrl() kw['resource_uid'] = self.getUid()
return self.portal_simulation.getMovementHistoryStat(**kw) portal_simulation = getToolByName(self, 'portal_simulation')
return portal_simulation.getMovementHistoryStat(**kw)
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getNextNegativeInventoryDate') 'getNextNegativeInventoryDate')
...@@ -430,8 +467,9 @@ class Resource(XMLMatrix, CoreResource, Variated): ...@@ -430,8 +467,9 @@ class Resource(XMLMatrix, CoreResource, Variated):
""" """
Returns list of inventory grouped by section or site Returns list of inventory grouped by section or site
""" """
kw['resource'] = self.getRelativeUrl() kw['resource_uid'] = self.getUid()
return self.portal_simulation.getNextNegativeInventoryDate(**kw) portal_simulation = getToolByName(self, 'portal_simulation')
return portal_simulation.getNextNegativeInventoryDate(**kw)
# Asset Price API # Asset Price API
...@@ -441,8 +479,9 @@ class Resource(XMLMatrix, CoreResource, Variated): ...@@ -441,8 +479,9 @@ class Resource(XMLMatrix, CoreResource, Variated):
""" """
Returns list of inventory grouped by section or site Returns list of inventory grouped by section or site
""" """
kw['resource'] = self.getRelativeUrl() kw['resource_uid'] = self.getUid()
return self.portal_simulation.getInventoryAssetPrice(**kw) portal_simulation = getToolByName(self, 'portal_simulation')
return portal_simulation.getInventoryAssetPrice(**kw)
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getCurrentInventoryAssetPrice') 'getCurrentInventoryAssetPrice')
...@@ -450,8 +489,9 @@ class Resource(XMLMatrix, CoreResource, Variated): ...@@ -450,8 +489,9 @@ class Resource(XMLMatrix, CoreResource, Variated):
""" """
Returns list of inventory grouped by section or site Returns list of inventory grouped by section or site
""" """
kw['resource'] = self.getRelativeUrl() kw['resource_uid'] = self.getUid()
return self.portal_simulation.getCurrentInventoryAssetPrice(**kw) portal_simulation = getToolByName(self, 'portal_simulation')
return portal_simulation.getCurrentInventoryAssetPrice(**kw)
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getAvailableInventoryAssetPrice') 'getAvailableInventoryAssetPrice')
...@@ -459,8 +499,9 @@ class Resource(XMLMatrix, CoreResource, Variated): ...@@ -459,8 +499,9 @@ class Resource(XMLMatrix, CoreResource, Variated):
""" """
Returns list of inventory grouped by section or site Returns list of inventory grouped by section or site
""" """
kw['resource'] = self.getRelativeUrl() kw['resource_uid'] = self.getUid()
return self.portal_simulation.getAvailableInventoryAssetPrice(**kw) portal_simulation = getToolByName(self, 'portal_simulation')
return portal_simulation.getAvailableInventoryAssetPrice(**kw)
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getFutureInventoryAssetPrice') 'getFutureInventoryAssetPrice')
...@@ -468,8 +509,9 @@ class Resource(XMLMatrix, CoreResource, Variated): ...@@ -468,8 +509,9 @@ class Resource(XMLMatrix, CoreResource, Variated):
""" """
Returns list of inventory grouped by section or site Returns list of inventory grouped by section or site
""" """
kw['resource'] = self.getRelativeUrl() kw['resource_uid'] = self.getUid()
return self.portal_simulation.getFutureInventoryAssetPrice(**kw) portal_simulation = getToolByName(self, 'portal_simulation')
return portal_simulation.getFutureInventoryAssetPrice(**kw)
# Industrial price API # Industrial price API
......
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