Commit a5fcda1e authored by Alexandre Boeglin's avatar Alexandre Boeglin

Finished Stock related methods.

Moved arguments analysis to a separate function.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@2780 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b9f6ec7b
...@@ -200,74 +200,18 @@ class SimulationTool (BaseTool): ...@@ -200,74 +200,18 @@ class SimulationTool (BaseTool):
####################################################### #######################################################
# Stock Management # Stock Management
security.declareProtected(Permissions.AccessContentsInformation, 'getInventory')
def getInventory(self, from_date=None, to_date=None, at_date=None, def _generateSQLKeywordDict(self, from_date=None, to_date=None, at_date=None,
resource=None, node=None, payment=None, resource=None, node=None, payment=None,
section=None, mirror_section=None, section=None, mirror_section=None,
resource_category=None, node_category=None, payment_category=None, resource_category=None, node_category=None, payment_category=None,
section_category=None, mirror_section_category=None, section_category=None, mirror_section_category=None,
simulation_state=None, transit_simulation_state = None, omit_transit=0, simulation_state=None, transit_simulation_state = None, omit_transit=0,
input_simulation_state = None, output_simulation_state=None, input_simulation_state = None, output_simulation_state=None,
variation_text=None, variation_category=None, variation_text=None, variation_category=None,
ignore_variation=0, standardise=0, omit_simulation=0, omit_input=0, omit_output=0, **kw) :
selection_domain=None, selection_report=None, src__=0, **kw) :
""" """
from_date (>=) - generates keywork and calls buildSqlQuery
to_date (<) -
at_date (<=) - only take rows which date is <= at_date
resource (only in generic API in simulation)
node - only take rows in stock table which node_uid is equivalent to node
payment - only take rows in stock table which payment_uid is equivalent to payment
section - only take rows in stock table which section_uid is equivalent to section
mirror_section
resource_category - only take rows in stock table which resource_uid is in resource_category
node_category - only take rows in stock table which node_uid is in section_category
payment_category - only take rows in stock table which payment_uid is in section_category
section_category - only take rows in stock table which section_uid is in section_category
mirror_section_category
variation_text - only take rows in stock table with specified variation_text
this needs to be extended with some kind of variation_category ?
XXX this way of implementing variation selection is far from perfect
variation_category - variation or list of possible variations
simulation_state - only take rows with specified simulation_state
transit_simulation_state - take rows with specified transit_simulation_state and quantity < 0
omit_transit - do not evaluate transit_simulation_state
input_simulation_state - only take rows with specified input_simulation_state and quantity > 0
output_simulation_state - only take rows with specified output_simulation_state and quantity < 0
ignore_variation - do not take into account variation in inventory calculation
standardise - provide a standard quantity rather than an SKU
omit_simulation
omit_input
omit_output
selection_domain, selection_report - see ListBox
**kw - if we want extended selection with more keywords (but bad performance)
check what we can do with buildSqlQuery
""" """
new_kw = {} new_kw = {}
new_kw.update(kw) new_kw.update(kw)
...@@ -350,7 +294,7 @@ class SimulationTool (BaseTool): ...@@ -350,7 +294,7 @@ class SimulationTool (BaseTool):
for resource_category_item in resource_category : for resource_category_item in resource_category :
resource_category_uid_list.append(self.portal_categories.restrictedTraverse(resource_category_item).getUid()) resource_category_uid_list.append(self.portal_categories.restrictedTraverse(resource_category_item).getUid())
if len(resource_category_uid_list) : if len(resource_category_uid_list) :
new_kw['resourceCategory'] = resource_category_uid_list new_kw['stock_resourceCategory'] = resource_category_uid_list
node_category_uid_list = [] node_category_uid_list = []
if type(node_category) is type('') : if type(node_category) is type('') :
...@@ -359,7 +303,7 @@ class SimulationTool (BaseTool): ...@@ -359,7 +303,7 @@ class SimulationTool (BaseTool):
for node_category_item in node_category : for node_category_item in node_category :
node_category_uid_list.append(self.portal_categories.restrictedTraverse(node_category_item).getUid()) node_category_uid_list.append(self.portal_categories.restrictedTraverse(node_category_item).getUid())
if len(node_category_uid_list) : if len(node_category_uid_list) :
new_kw['nodeCategory'] = node_category_uid_list new_kw['stock_nodeCategory'] = node_category_uid_list
payment_category_uid_list = [] payment_category_uid_list = []
if type(payment_category) is type('') : if type(payment_category) is type('') :
...@@ -368,7 +312,7 @@ class SimulationTool (BaseTool): ...@@ -368,7 +312,7 @@ class SimulationTool (BaseTool):
for payment_category_item in payment_category : for payment_category_item in payment_category :
payment_category_uid_list.append(self.portal_categories.restrictedTraverse(payment_category_item).getUid()) payment_category_uid_list.append(self.portal_categories.restrictedTraverse(payment_category_item).getUid())
if len(payment_category_uid_list) : if len(payment_category_uid_list) :
new_kw['paymentCategory'] = payment_category_uid_list new_kw['stock_paymentCategory'] = payment_category_uid_list
section_category_uid_list = [] section_category_uid_list = []
if type(section_category) is type('') : if type(section_category) is type('') :
...@@ -377,7 +321,7 @@ class SimulationTool (BaseTool): ...@@ -377,7 +321,7 @@ class SimulationTool (BaseTool):
for section_category_item in section_category : for section_category_item in section_category :
section_category_uid_list.append(self.portal_categories.restrictedTraverse(section_category_item).getUid()) section_category_uid_list.append(self.portal_categories.restrictedTraverse(section_category_item).getUid())
if len(section_category_uid_list) : if len(section_category_uid_list) :
new_kw['sectionCategory'] = section_category_uid_list new_kw['stock_sectionCategory'] = section_category_uid_list
mirror_section_category_uid_list = [] mirror_section_category_uid_list = []
if type(mirror_section_category) is type('') : if type(mirror_section_category) is type('') :
...@@ -386,7 +330,7 @@ class SimulationTool (BaseTool): ...@@ -386,7 +330,7 @@ class SimulationTool (BaseTool):
for mirror_section_category_item in mirror_section_category : for mirror_section_category_item in mirror_section_category :
mirror_section_category_uid_list.append(self.portal_categories.restrictedTraverse(mirror_section_category_item).getUid()) mirror_section_category_uid_list.append(self.portal_categories.restrictedTraverse(mirror_section_category_item).getUid())
if len(mirror_section_category_uid_list) : if len(mirror_section_category_uid_list) :
new_kw['mirrorSectionCategory'] = mirror_section_category_uid_list new_kw['stock_mirrorSectionCategory'] = mirror_section_category_uid_list
variation_category_uid_list = [] variation_category_uid_list = []
if type(variation_category) is type('') : if type(variation_category) is type('') :
...@@ -433,14 +377,80 @@ class SimulationTool (BaseTool): ...@@ -433,14 +377,80 @@ class SimulationTool (BaseTool):
sql_kw.update(self.portal_catalog.buildSQLQuery(**new_kw)) sql_kw.update(self.portal_catalog.buildSQLQuery(**new_kw))
return sql_kw
security.declareProtected(Permissions.AccessContentsInformation, 'getInventory')
def getInventory(self, src__=0,
ignore_variation=0, standardise=0, omit_simulation=0, omit_input=0, omit_output=0,
selection_domain=None, selection_report=None, **kw) :
"""
from_date (>=) -
to_date (<) -
at_date (<=) - only take rows which date is <= at_date
resource (only in generic API in simulation)
node - only take rows in stock table which node_uid is equivalent to node
payment - only take rows in stock table which payment_uid is equivalent to payment
section - only take rows in stock table which section_uid is equivalent to section
mirror_section
resource_category - only take rows in stock table which resource_uid is in resource_category
node_category - only take rows in stock table which node_uid is in section_category
payment_category - only take rows in stock table which payment_uid is in section_category
section_category - only take rows in stock table which section_uid is in section_category
mirror_section_category
variation_text - only take rows in stock table with specified variation_text
this needs to be extended with some kind of variation_category ?
XXX this way of implementing variation selection is far from perfect
variation_category - variation or list of possible variations
simulation_state - only take rows with specified simulation_state
transit_simulation_state - take rows with specified transit_simulation_state and quantity < 0
omit_transit - do not evaluate transit_simulation_state
input_simulation_state - only take rows with specified input_simulation_state and quantity > 0
output_simulation_state - only take rows with specified output_simulation_state and quantity < 0
ignore_variation - do not take into account variation in inventory calculation
standardise - provide a standard quantity rather than an SKU
omit_simulation
omit_input
omit_output
selection_domain, selection_report - see ListBox
**kw - if we want extended selection with more keywords (but bad performance)
check what we can do with buildSqlQuery
"""
sql_kw = self._generateSQLKeywordDict(**kw)
if src__ : if src__ :
return self.Resource_zGetInventory(src__=1, ignore_variation=ignore_variation, return self.Resource_zGetInventory(src__=1,
standardise=standardise, omit_simulation=omit_simulation, 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_report=selection_report, **sql_kw) selection_domain=selection_domain, selection_report=selection_report, **sql_kw)
result = self.Resource_zGetInventory(ignore_variation=ignore_variation, result = self.Resource_zGetInventory(
standardise=standardise, omit_simulation=omit_simulation, 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_report=selection_report, **sql_kw) selection_domain=selection_domain, selection_report=selection_report, **sql_kw)
if len(result) > 0: if len(result) > 0:
...@@ -469,40 +479,36 @@ class SimulationTool (BaseTool): ...@@ -469,40 +479,36 @@ class SimulationTool (BaseTool):
""" """
Returns future inventory Returns future inventory
""" """
kw['simulation_state'] = tuple(list(self.getPortalFutureInventoryStateList())
+ list(self.getPortalReservedInventoryStateList()) + list(self.getPortalCurrentInventoryStateList()))
return self.getInventory(**kw) return self.getInventory(**kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getInventoryList') security.declareProtected(Permissions.AccessContentsInformation, 'getInventoryList')
def getInventoryList(self, from_date=None, to_date=None, at_date=None, def getInventoryList(self, src__=0,
resource=None, node=None, payment=None,
section=None, mirror_section=None,
resource_category=None, node_category=None, payment_category=None,
section_category=None, mirror_section_category=None,
simulation_state=None, transit_simulation_state = None, omit_transit=0,
input_simulation_state = None, output_simulation_state=None,
variation_text=None, variation_category=None,
ignore_variation=0, standardise=0, omit_simulation=0, omit_input=0, omit_output=0, ignore_variation=0, standardise=0, omit_simulation=0, omit_input=0, omit_output=0,
selection_domain=None, selection_report=None, src__=0, **kw): selection_domain=None, selection_report=None, **kw) :
""" """
Returns list of inventory grouped by section or site Returns list of inventory grouped by section or site
""" """
if section_category is None: sql_kw = self._generateSQLKeywordDict(**kw)
section_category = self.getPortalDefaultSectionCategory()
if type(simulation_state) is type(''): if src__ :
simulation_state = [simulation_state] return self.Resource_zGetInventoryList(src__=1,
return self.Resource_zGetInventoryList(resource_uid = [self.getUid()], ignore_variation=ignore_variation, standardise=standardise, omit_simulation=omit_simulation,
resource=None, omit_input=omit_input, omit_output=omit_output,
to_date=at_date, selection_domain=selection_domain, selection_report=selection_report, **sql_kw)
section=section, node=node, payment=payment,
node_category=node_category, return self.Resource_zGetInventoryList(
section_category=section_category, payment_category=payment_category, ignore_variation=ignore_variation, standardise=standardise, omit_simulation=omit_simulation,
simulation_state=simulation_state, omit_input=omit_input, omit_output=omit_output,
**kw) selection_domain=selection_domain, selection_report=selection_report, **sql_kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getCurrentInventoryList') security.declareProtected(Permissions.AccessContentsInformation, 'getCurrentInventoryList')
def getCurrentInventoryList(self, **kw): def getCurrentInventoryList(self, **kw):
""" """
Returns list of current inventory grouped by section or site Returns list of current inventory grouped by section or site
""" """
kw['simulation_state'] = self.getPortalCurrentInventoryStateList()
return self.getInventoryList(**kw) return self.getInventoryList(**kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getFutureInventoryList') security.declareProtected(Permissions.AccessContentsInformation, 'getFutureInventoryList')
...@@ -510,40 +516,36 @@ class SimulationTool (BaseTool): ...@@ -510,40 +516,36 @@ class SimulationTool (BaseTool):
""" """
Returns list of future inventory grouped by section or site Returns list of future inventory grouped by section or site
""" """
kw['simulation_state'] = tuple(list(self.getPortalFutureInventoryStateList())
+ list(self.getPortalReservedInventoryStateList()) + list(self.getPortalCurrentInventoryStateList()))
return self.getInventoryList(**kw) return self.getInventoryList(**kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getInventoryStat') security.declareProtected(Permissions.AccessContentsInformation, 'getInventoryStat')
def getInventoryStat(self, from_date=None, to_date=None, at_date=None, def getInventoryStat(self, src__=0,
resource=None, node=None, payment=None,
section=None, mirror_section=None,
resource_category=None, node_category=None, payment_category=None,
section_category=None, mirror_section_category=None,
simulation_state=None, transit_simulation_state = None, omit_transit=0,
input_simulation_state = None, output_simulation_state=None,
variation_text=None, variation_category=None,
ignore_variation=0, standardise=0, omit_simulation=0, omit_input=0, omit_output=0, ignore_variation=0, standardise=0, omit_simulation=0, omit_input=0, omit_output=0,
selection_domain=None, selection_report=None, src__=0, **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 section_category is None: sql_kw = self._generateSQLKeywordDict(**kw)
section_category = self.getPortalDefaultSectionCategory()
if type(simulation_state) is type(''): if src__ :
simulation_state = [simulation_state] return self.Resource_zGetInventory(src__=1,
return self.Resource_zGetInventory(resource_uid = [self.getUid()], ignore_variation=ignore_variation, standardise=standardise, omit_simulation=omit_simulation,
resource=None, omit_input=omit_input, omit_output=omit_output,
to_date=at_date, selection_domain=selection_domain, selection_report=selection_report, **sql_kw)
section=section, node=node, payment=payment,
node_category=node_category, return self.Resource_zGetInventory(
section_category=section_category, payment_category=payment_category, ignore_variation=ignore_variation, standardise=standardise, omit_simulation=omit_simulation,
simulation_state=simulation_state, omit_input=omit_input, omit_output=omit_output,
**kw) selection_domain=selection_domain, selection_report=selection_report, **sql_kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getCurrentInventoryStat') security.declareProtected(Permissions.AccessContentsInformation, 'getCurrentInventoryStat')
def getCurrentInventoryStat(self, **kw): def getCurrentInventoryStat(self, **kw):
""" """
Returns statistics of current inventory grouped by section or site Returns statistics of current inventory grouped by section or site
""" """
kw['simulation_state'] = self.getPortalCurrentInventoryStateList()
return self.getInventoryStat(**kw) return self.getInventoryStat(**kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getFutureInventoryStat') security.declareProtected(Permissions.AccessContentsInformation, 'getFutureInventoryStat')
...@@ -551,40 +553,27 @@ class SimulationTool (BaseTool): ...@@ -551,40 +553,27 @@ class SimulationTool (BaseTool):
""" """
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())
+ list(self.getPortalReservedInventoryStateList()) + list(self.getPortalCurrentInventoryStateList()))
return self.getInventoryStat(**kw) return self.getInventoryStat(**kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getInventoryChart') security.declareProtected(Permissions.AccessContentsInformation, 'getInventoryChart')
def getInventoryChart(self, from_date=None, to_date=None, at_date=None, def getInventoryChart(self, **kw):
resource=None, node=None, payment=None,
section=None, mirror_section=None,
resource_category=None, node_category=None, payment_category=None,
section_category=None, mirror_section_category=None,
simulation_state=None, transit_simulation_state = None, omit_transit=0,
input_simulation_state = None, output_simulation_state=None,
variation_text=None, variation_category=None,
ignore_variation=0, standardise=0, omit_simulation=0, omit_input=0, omit_output=0,
selection_domain=None, selection_report=None, src__=0, **kw):
""" """
Returns list of inventory grouped by section or site Returns list of inventory grouped by section or site
""" """
if section_category is None: if src__ :
section_category = self.getPortalDefaultSectionCategory() return self.getInventoryList(src__=1, **kw)
if type(simulation_state) is type(''):
simulation_state = [simulation_state] result = self.getInventoryList(**kw)
return self.Resource_zGetInventoryChart(resource_uid = [self.getUid()], return map(lambda r: (r.node_title, r.inventory), result)
resource=None,
to_date=at_date,
section=section, node=node, payment=payment,
node_category=node_category,
section_category=section_category, payment_category=payment_category,
simulation_state=simulation_state,
**kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getCurrentInventoryChart') security.declareProtected(Permissions.AccessContentsInformation, 'getCurrentInventoryChart')
def getCurrentInventoryChart(self, **kw): def getCurrentInventoryChart(self, **kw):
""" """
Returns list of current inventory grouped by section or site Returns list of current inventory grouped by section or site
""" """
kw['simulation_state'] = self.getPortalCurrentInventoryStateList()
return self.getInventoryChart(**kw) return self.getInventoryChart(**kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getFutureInventoryChart') security.declareProtected(Permissions.AccessContentsInformation, 'getFutureInventoryChart')
...@@ -592,40 +581,36 @@ class SimulationTool (BaseTool): ...@@ -592,40 +581,36 @@ class SimulationTool (BaseTool):
""" """
Returns list of future inventory grouped by section or site Returns list of future inventory grouped by section or site
""" """
kw['simulation_state'] = tuple(list(self.getPortalFutureInventoryStateList())
+ list(self.getPortalReservedInventoryStateList()) + list(self.getPortalCurrentInventoryStateList()))
return self.getInventoryChart(**kw) return self.getInventoryChart(**kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getInventoryAssetPrice') security.declareProtected(Permissions.AccessContentsInformation, 'getInventoryAssetPrice')
def getInventoryAssetPrice(self, from_date=None, to_date=None, at_date=None, def getInventoryAssetPrice(self, src__=0,
resource=None, node=None, payment=None,
section=None, mirror_section=None,
resource_category=None, node_category=None, payment_category=None,
section_category=None, mirror_section_category=None,
simulation_state=None, transit_simulation_state = None, omit_transit=0,
input_simulation_state = None, output_simulation_state=None,
variation_text=None, variation_category=None,
ignore_variation=0, standardise=0, omit_simulation=0, omit_input=0, omit_output=0, ignore_variation=0, standardise=0, omit_simulation=0, omit_input=0, omit_output=0,
selection_domain=None, selection_report=None, src__=0, **kw): selection_domain=None, selection_report=None, **kw):
""" """
Returns list of inventory grouped by section or site Returns list of inventory grouped by section or site
""" """
if section_category is None: sql_kw = self._generateSQLKeywordDict(**kw)
section_category = self.getPortalDefaultSectionCategory()
if type(simulation_state) is type(''): if src__ :
simulation_state = [simulation_state] return self.Resource_zGetInventoryAssetPrice(src__=1,
return self.Resource_zGetInventoryAssetPrice(resource_uid = [self.getUid()], ignore_variation=ignore_variation, standardise=standardise, omit_simulation=omit_simulation,
resource=None, omit_input=omit_input, omit_output=omit_output,
to_date=at_date, selection_domain=selection_domain, selection_report=selection_report, **sql_kw)
section=section, node=node, payment=payment,
node_category=node_category, return self.Resource_zGetInventoryAssetPrice(
section_category=section_category, payment_category=payment_category, ignore_variation=ignore_variation, standardise=standardise, omit_simulation=omit_simulation,
simulation_state=simulation_state, omit_input=omit_input, omit_output=omit_output,
**kw) selection_domain=selection_domain, selection_report=selection_report, **sql_kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getCurrentInventoryAssetPrice') security.declareProtected(Permissions.AccessContentsInformation, 'getCurrentInventoryAssetPrice')
def getCurrentInventoryAssetPrice(self, **kw): def getCurrentInventoryAssetPrice(self, **kw):
""" """
Returns list of current inventory grouped by section or site Returns list of current inventory grouped by section or site
""" """
kw['simulation_state'] = self.getPortalCurrentInventoryStateList()
return self.getInventoryAssetPrice(**kw) return self.getInventoryAssetPrice(**kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getAvailableInventoryAssetPrice') security.declareProtected(Permissions.AccessContentsInformation, 'getAvailableInventoryAssetPrice')
...@@ -634,6 +619,7 @@ class SimulationTool (BaseTool): ...@@ -634,6 +619,7 @@ class SimulationTool (BaseTool):
Returns list of available inventory grouped by section or site Returns list of available inventory grouped by section or site
(current inventory - deliverable) (current inventory - deliverable)
""" """
kw['simulation_state'] = self.getPortalCurrentInventoryStateList()
return self.getInventoryAssetPrice(**kw) return self.getInventoryAssetPrice(**kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getFutureInventoryAssetPrice') security.declareProtected(Permissions.AccessContentsInformation, 'getFutureInventoryAssetPrice')
...@@ -641,159 +627,115 @@ class SimulationTool (BaseTool): ...@@ -641,159 +627,115 @@ class SimulationTool (BaseTool):
""" """
Returns list of future inventory grouped by section or site Returns list of future inventory grouped by section or site
""" """
kw['simulation_state'] = tuple(list(self.getPortalFutureInventoryStateList())
+ list(self.getPortalReservedInventoryStateList()) + list(self.getPortalCurrentInventoryStateList()))
return self.getInventoryAssetPrice(**kw) return self.getInventoryAssetPrice(**kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getInventoryHistoryList') security.declareProtected(Permissions.AccessContentsInformation, 'getInventoryHistoryList')
def getInventoryHistoryList(self, from_date=None, to_date=None, at_date=None, def getInventoryHistoryList(self, src__=0,
resource=None, node=None, payment=None,
section=None, mirror_section=None,
resource_category=None, node_category=None, payment_category=None,
section_category=None, mirror_section_category=None,
simulation_state=None, transit_simulation_state = None, omit_transit=0,
input_simulation_state = None, output_simulation_state=None,
variation_text=None, variation_category=None,
ignore_variation=0, standardise=0, omit_simulation=0, omit_input=0, omit_output=0, ignore_variation=0, standardise=0, omit_simulation=0, omit_input=0, omit_output=0,
selection_domain=None, selection_report=None, src__=0, **kw): selection_domain=None, selection_report=None, **kw):
""" """
Returns list of inventory grouped by section or site Returns list of inventory grouped by section or site
""" """
if section_category is None: sql_kw = self._generateSQLKeywordDict(**kw)
section_category = self.getPortalDefaultSectionCategory()
if type(simulation_state) is type(''): if src__ :
simulation_state = [simulation_state] return self.Resource_getInventoryHistoryList(src__=1,
return self.Resource_getInventoryHistoryList( resource = self._getMovementResourceList(), ignore_variation=ignore_variation, standardise=standardise, omit_simulation=omit_simulation,
from_date=from_date, omit_input=omit_input, omit_output=omit_output,
to_date=to_date, selection_domain=selection_domain, selection_report=selection_report, **sql_kw)
section=section,
node=node, return self.Resource_getInventoryHistoryList(
payment=payment, ignore_variation=ignore_variation, standardise=standardise, omit_simulation=omit_simulation,
node_category=node_category, omit_input=omit_input, omit_output=omit_output,
section_category=section_category, selection_domain=selection_domain, selection_report=selection_report, **sql_kw)
payment_category=payment_category,
simulation_state = simulation_state,
**kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getInventoryHistoryChart') security.declareProtected(Permissions.AccessContentsInformation, 'getInventoryHistoryChart')
def getInventoryHistoryChart(self, from_date=None, to_date=None, at_date=None, def getInventoryHistoryChart(self, src__=0,
resource=None, node=None, payment=None,
section=None, mirror_section=None,
resource_category=None, node_category=None, payment_category=None,
section_category=None, mirror_section_category=None,
simulation_state=None, transit_simulation_state = None, omit_transit=0,
input_simulation_state = None, output_simulation_state=None,
variation_text=None, variation_category=None,
ignore_variation=0, standardise=0, omit_simulation=0, omit_input=0, omit_output=0, ignore_variation=0, standardise=0, omit_simulation=0, omit_input=0, omit_output=0,
selection_domain=None, selection_report=None, src__=0, **kw): selection_domain=None, selection_report=None, **kw):
""" """
Returns list of inventory grouped by section or site Returns list of inventory grouped by section or site
""" """
if section_category is None: sql_kw = self._generateSQLKeywordDict(**kw)
section_category = self.getPortalDefaultSectionCategory()
if type(simulation_state) is type(''): if src__ :
simulation_state = [simulation_state] return self.Resource_getInventoryHistoryChart(src__=1,
return self.Resource_getInventoryHistoryChart( resource = self._getMovementResourceList(), ignore_variation=ignore_variation, standardise=standardise, omit_simulation=omit_simulation,
from_date=from_date, omit_input=omit_input, omit_output=omit_output,
to_date=to_date, selection_domain=selection_domain, selection_report=selection_report, **sql_kw)
section=section,
node=node, return self.Resource_getInventoryHistoryChart(
payment=payment, ignore_variation=ignore_variation, standardise=standardise, omit_simulation=omit_simulation,
node_category=node_category, omit_input=omit_input, omit_output=omit_output,
section_category=section_category, selection_domain=selection_domain, selection_report=selection_report, **sql_kw)
payment_category=payment_category,
simulation_state = simulation_state,
**kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getMovementHistoryList') security.declareProtected(Permissions.AccessContentsInformation, 'getMovementHistoryList')
def getMovementHistoryList(self, from_date=None, to_date=None, at_date=None, def getMovementHistoryList(self, src__=0,
resource=None, node=None, payment=None,
section=None, mirror_section=None,
resource_category=None, node_category=None, payment_category=None,
section_category=None, mirror_section_category=None,
simulation_state=None, transit_simulation_state = None, omit_transit=0,
input_simulation_state = None, output_simulation_state=None,
variation_text=None, variation_category=None,
ignore_variation=0, standardise=0, omit_simulation=0, omit_input=0, omit_output=0, ignore_variation=0, standardise=0, omit_simulation=0, omit_input=0, omit_output=0,
selection_domain=None, selection_report=None, src__=0, **kw): selection_domain=None, selection_report=None, **kw):
""" """
Returns list of inventory grouped by section or site Returns list of inventory grouped by section or site
""" """
if section_category is None: sql_kw = self._generateSQLKeywordDict(**kw)
section_category = self.getPortalDefaultSectionCategory()
if type(simulation_state) is type(''): if src__ :
simulation_state = [simulation_state] return self.Resource_zGetMovementHistoryList(src__=1,
return self.Resource_zGetMovementHistoryList( resource = self._getMovementResourceList(), ignore_variation=ignore_variation, standardise=standardise, omit_simulation=omit_simulation,
from_date=from_date, omit_input=omit_input, omit_output=omit_output,
to_date=to_date, selection_domain=selection_domain, selection_report=selection_report, **sql_kw)
section=section,
node=node, return self.Resource_zGetMovementHistoryList(
payment=payment, ignore_variation=ignore_variation, standardise=standardise, omit_simulation=omit_simulation,
node_category=node_category, omit_input=omit_input, omit_output=omit_output,
section_category=section_category, selection_domain=selection_domain, selection_report=selection_report, **sql_kw)
payment_category=payment_category,
simulation_state = simulation_state,
**kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getMovementHistoryStat') security.declareProtected(Permissions.AccessContentsInformation, 'getMovementHistoryStat')
def getMovementHistoryStat(self, from_date=None, to_date=None, at_date=None, def getMovementHistoryStat(self, src__=0,
resource=None, node=None, payment=None,
section=None, mirror_section=None,
resource_category=None, node_category=None, payment_category=None,
section_category=None, mirror_section_category=None,
simulation_state=None, transit_simulation_state = None, omit_transit=0,
input_simulation_state = None, output_simulation_state=None,
variation_text=None, variation_category=None,
ignore_variation=0, standardise=0, omit_simulation=0, omit_input=0, omit_output=0, ignore_variation=0, standardise=0, omit_simulation=0, omit_input=0, omit_output=0,
selection_domain=None, selection_report=None, src__=0, **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 section_category is None: sql_kw = self._generateSQLKeywordDict(**kw)
section_category = self.getPortalDefaultSectionCategory()
if type(simulation_state) is type(''): if src__ :
simulation_state = [simulation_state] return self.Resource_zGetInventory(src__=1,
return self.Resource_zGetInventory( resource = self._getMovementResourceList(), ignore_variation=ignore_variation, standardise=standardise, omit_simulation=omit_simulation,
from_date=from_date, omit_input=omit_input, omit_output=omit_output,
to_date=to_date, selection_domain=selection_domain, selection_report=selection_report, **sql_kw)
section=section,
node=node, return self.Resource_zGetInventory(
payment=payment, ignore_variation=ignore_variation, standardise=standardise, omit_simulation=omit_simulation,
node_category=node_category, omit_input=omit_input, omit_output=omit_output,
section_category=section_category, selection_domain=selection_domain, selection_report=selection_report, **sql_kw)
payment_category=payment_category,
simulation_state = simulation_state,
**kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getNextNegativeInventoryDate') security.declareProtected(Permissions.AccessContentsInformation, 'getNextNegativeInventoryDate')
def getNextNegativeInventoryDate(self, from_date=None, to_date=None, at_date=None, def getNextNegativeInventoryDate(self, src__=0,
resource=None, node=None, payment=None,
section=None, mirror_section=None,
resource_category=None, node_category=None, payment_category=None,
section_category=None, mirror_section_category=None,
simulation_state=None, transit_simulation_state = None, omit_transit=0,
input_simulation_state = None, output_simulation_state=None,
variation_text=None, variation_category=None,
ignore_variation=0, standardise=0, omit_simulation=0, omit_input=0, omit_output=0, ignore_variation=0, standardise=0, omit_simulation=0, omit_input=0, omit_output=0,
selection_domain=None, selection_report=None, src__=0, **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 section_category is None: sql_kw = self._generateSQLKeywordDict(**kw)
section_category = self.getPortalDefaultSectionCategory()
if type(simulation_state) is type(''): if src__ :
simulation_state = [simulation_state] return self.Resource_getInventoryHistoryList(src__=1,
if from_date is None: ignore_variation=ignore_variation, standardise=standardise, omit_simulation=omit_simulation,
from_date = DateTime() omit_input=omit_input, omit_output=omit_output,
return self.Resource_getInventoryHistoryList( resource = self._getMovementResourceList(), selection_domain=selection_domain, selection_report=selection_report, **sql_kw)
from_date=from_date,
to_date=to_date, result = self.Resource_getInventoryHistoryList(
section=section, ignore_variation=ignore_variation, standardise=standardise, omit_simulation=omit_simulation,
node=node, omit_input=omit_input, omit_output=omit_output,
payment=payment, selection_domain=selection_domain, selection_report=selection_report, **sql_kw)
node_category=node_category,
section_category=section_category, for inventory in result:
payment_category=payment_category, if inventory['inventory'] < 0:
simulation_state = simulation_state, return inventory['stop_date']
**kw)
return None
####################################################### #######################################################
# Movement Group Collection / Delivery Creation # Movement Group Collection / Delivery Creation
......
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