Commit 21ee76db authored by Jean-Paul Smets's avatar Jean-Paul Smets

Added support for payment nodes in inventory API


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@2620 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent cf57eb76
...@@ -147,13 +147,6 @@ Une ligne tarifaire.""" ...@@ -147,13 +147,6 @@ Une ligne tarifaire."""
""" """
return 1.0 return 1.0
security.declareProtected(Permissions.AccessContentsInformation, 'getTargetQuantity')
def getTargetQuantity(self):
"""
Returns 1 because only one container is shipped
"""
return 1.0
security.declareProtected(Permissions.AccessContentsInformation, 'isAccountable') security.declareProtected(Permissions.AccessContentsInformation, 'isAccountable')
def isAccountable(self): def isAccountable(self):
""" """
...@@ -218,3 +211,31 @@ Une ligne tarifaire.""" ...@@ -218,3 +211,31 @@ Une ligne tarifaire."""
def getContainer(self): def getContainer(self):
return self.getRelativeUrl() return self.getRelativeUrl()
# Quantity methods
security.declareProtected(Permissions.AccessContentsInformation, 'getContainer')
def getContainedTotalQuantity(self, recursive = 0):
"""
The sum of quantities of contained lines
"""
result = 0.0
for o in self.contentValues(filter = {'portal_type': self.getPortalContainerLineTypeList()}):
result += o.getTotalQuantity()
if recursive:
for o in self.contentValues(filter = {'portal_type': self.getPortalContainerTypeList()}):
result += o.getContainedTotalQuantity()
return result
security.declareProtected(Permissions.AccessContentsInformation, 'getContainer')
def getContainedTotalPrice(self, recursive = 0):
"""
The sum of price of contained lines
"""
result = 0.0
for o in self.contentValues(filter = {'portal_type': self.getPortalContainerLineTypeList()}):
result += o.getTotalPrice()
if recursive:
for o in self.contentValues(filter = {'portal_type': self.getPortalContainerTypeList()}):
result += o.getContainedTotalPrice()
return result
\ No newline at end of file
...@@ -553,19 +553,25 @@ class Delivery(XMLObject): ...@@ -553,19 +553,25 @@ class Delivery(XMLObject):
c.updatePrice() c.updatePrice()
security.declareProtected(Permissions.AccessContentsInformation, 'getTotalPrice') security.declareProtected(Permissions.AccessContentsInformation, 'getTotalPrice')
def getTotalPrice(self): def getTotalPrice(self, src__=0, **kw):
""" """
Returns the total price for this order Returns the total price for this order
""" """
aggregate = self.Delivery_zGetTotal()[0] kw.update(self.portal_catalog.buildSQLQuery(**kw))
if src__:
return self.Delivery_zGetTotal(src__=1, uid=self.getUid(), **kw)
aggregate = self.Delivery_zGetTotal(uid=self.getUid(), **kw)[0]
return aggregate.total_price return aggregate.total_price
security.declareProtected(Permissions.AccessContentsInformation, 'getTotalQuantity') security.declareProtected(Permissions.AccessContentsInformation, 'getTotalQuantity')
def getTotalQuantity(self): def getTotalQuantity(self, src__=0, **kw):
""" """
Returns the quantity if no cell or the total quantity if cells Returns the quantity if no cell or the total quantity if cells
""" """
aggregate = self.Delivery_zGetTotal(uid=self.getUid())[0] kw.update(self.portal_catalog.buildSQLQuery(**kw))
if src__:
return self.Delivery_zGetTotal(src__=1, uid=self.getUid(), **kw)
aggregate = self.Delivery_zGetTotal(uid=self.getUid(), **kw)[0]
return aggregate.total_quantity return aggregate.total_quantity
security.declareProtected(Permissions.AccessContentsInformation, 'getDeliveryUid') security.declareProtected(Permissions.AccessContentsInformation, 'getDeliveryUid')
...@@ -876,8 +882,8 @@ class Delivery(XMLObject): ...@@ -876,8 +882,8 @@ class Delivery(XMLObject):
return resource_dict.keys() return resource_dict.keys()
security.declareProtected(Permissions.AccessContentsInformation, 'getInventory') security.declareProtected(Permissions.AccessContentsInformation, 'getInventory')
def getInventory(self, at_date = None, section = None, node = None, def getInventory(self, at_date = None, section = None, node = None, payment = None,
node_category=None, section_category=None, simulation_state=None, node_category=None, section_category=None, payment_category = None, simulation_state=None,
ignore_variation=0, **kw): ignore_variation=0, **kw):
if section_category is None: if section_category is None:
section_category = self.getPortalDefaultSectionCategory() section_category = self.getPortalDefaultSectionCategory()
...@@ -888,59 +894,66 @@ class Delivery(XMLObject): ...@@ -888,59 +894,66 @@ class Delivery(XMLObject):
resource_dict[m.getResource()] = 1 resource_dict[m.getResource()] = 1
result = self.Resource_zGetInventory( resource = self._getMovementResourceList(), result = self.Resource_zGetInventory( resource = self._getMovementResourceList(),
to_date=at_date, to_date=at_date,
section=section, node=node, section=section, node=node, payment=payment,
node_category=node_category, node_category=node_category,
section_category=section_category, section_category=section_category,
payment_category=payment_category,
simulation_state=simulation_state) simulation_state=simulation_state)
if len(result) > 0: if len(result) > 0:
return result[0].inventory return result[0].inventory
return 0.0 return 0.0
security.declareProtected(Permissions.AccessContentsInformation, 'getFutureInventory') security.declareProtected(Permissions.AccessContentsInformation, 'getFutureInventory')
def getFutureInventory(self, section = None, node = None, def getFutureInventory(self, section = None, node = None, payment = None,
node_category=None, section_category=None, simulation_state=None, node_category=None, section_category=None, payment_category = None, simulation_state=None,
ignore_variation=0, **kw): ignore_variation=0, **kw):
""" """
Returns inventory at infinite Returns inventory at infinite
""" """
if section_category is None: if section_category is None:
section_category = self.getPortalDefaultSectionCategory() section_category = self.getPortalDefaultSectionCategory()
return self.getInventory(at_date=None, section=section, node=node, return self.getInventory(at_date=None, section=section, node=node, payment=payment,
node_category=node_category, section_category=section_category, node_category=node_category,
section_category=section_category,
payment_category=payment_category,
simulation_state=list(self.getPortalFutureInventoryStateList())+\ simulation_state=list(self.getPortalFutureInventoryStateList())+\
list(self.getPortalReservedInventoryStateList())+\ list(self.getPortalReservedInventoryStateList())+\
list(self.getPortalCurrentInventoryStateList()), **kw) list(self.getPortalCurrentInventoryStateList()), **kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getCurrentInventory') security.declareProtected(Permissions.AccessContentsInformation, 'getCurrentInventory')
def getCurrentInventory(self, section = None, node = None, def getCurrentInventory(self, section = None, node = None, payment = None,
node_category=None, section_category=None, ignore_variation=0, **kw): node_category=None, section_category=None, payment_category = None, ignore_variation=0, **kw):
""" """
Returns current inventory Returns current inventory
""" """
if section_category is None: if section_category is None:
section_category = self.getPortalDefaultSectionCategory() section_category = self.getPortalDefaultSectionCategory()
return self.getInventory(section=section, node=node, return self.getInventory(section=section, node=node, payment=payment,
node_category=node_category, section_category=section_category, node_category=node_category,
section_category=section_category,
payment_category=payment_category,
simulation_state=self.getPortalCurrentInventoryStateList(), **kw) simulation_state=self.getPortalCurrentInventoryStateList(), **kw)
#return self.getInventory(section=section, node=node, #return self.getInventory(section=section, node=node, payment=payment
# node_category=node_category, section_category=section_category, # node_category=node_category, section_category=section_category, payment_category=payment_category,
# simulation_state='delivered', **kw) # simulation_state='delivered', **kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getAvailableInventory') security.declareProtected(Permissions.AccessContentsInformation, 'getAvailableInventory')
def getAvailableInventory(self, section = None, node = None, def getAvailableInventory(self, section = None, node = None, payment = None,
node_category=None, section_category=None, node_category=None, section_category=None, payment_category = None,
ignore_variation=0, **kw): ignore_variation=0, **kw):
""" """
Returns available inventory, ie. current inventory - deliverable Returns available inventory, ie. current inventory - deliverable
""" """
if section_category is None: if section_category is None:
section_category = self.getPortalDefaultSectionCategory() section_category = self.getPortalDefaultSectionCategory()
return self.getInventory(at_date=DateTime(), section=section, node=node, return self.getInventory(at_date=DateTime(), section=section, node=node, payment=payment,
node_category=node_category, section_category=section_category, **kw) node_category=node_category,
section_category=section_category,
payment_category=payment_category, **kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getInventoryList') security.declareProtected(Permissions.AccessContentsInformation, 'getInventoryList')
def getInventoryList(self, at_date = None, section = None, node = None, def getInventoryList(self, at_date = None, section = None, node = None, payment = None,
node_category=None, section_category=None, simulation_state=None, node_category=None, section_category=None, payment_category = None, simulation_state=None,
ignore_variation=0, **kw): ignore_variation=0, **kw):
""" """
Returns list of inventory grouped by section or site Returns list of inventory grouped by section or site
...@@ -954,45 +967,51 @@ class Delivery(XMLObject): ...@@ -954,45 +967,51 @@ class Delivery(XMLObject):
resource_dict[m.getResource()] = 1 resource_dict[m.getResource()] = 1
result = self.Resource_zGetInventoryList(resource = resource_dict.keys(), result = self.Resource_zGetInventoryList(resource = resource_dict.keys(),
to_date=at_date, to_date=at_date,
section=section, node=node, section=section, node=node, payment=payment,
node_category=node_category, node_category=node_category,
section_category=section_category, section_category=section_category,
payment_category=payment_category,
simulation_state=simulation_state, **kw) simulation_state=simulation_state, **kw)
return result return result
security.declareProtected(Permissions.AccessContentsInformation, 'getFutureInventoryList') security.declareProtected(Permissions.AccessContentsInformation, 'getFutureInventoryList')
def getFutureInventoryList(self, section = None, node = None, def getFutureInventoryList(self, section = None, node = None, payment = None,
node_category=None, section_category=None, simulation_state=None, node_category=None, section_category=None, payment_category = None, simulation_state=None,
ignore_variation=0, **kw): ignore_variation=0, **kw):
""" """
Returns list of future inventory grouped by section or site Returns list of future inventory grouped by section or site
""" """
if section_category is None: if section_category is None:
section_category = self.getPortalDefaultSectionCategory() section_category = self.getPortalDefaultSectionCategory()
return self.getInventoryList(at_date=None, section=section, node=node, return self.getInventoryList(at_date=None, section=section, node=node, payment=payment,
node_category=node_category, section_category=section_category, node_category=node_category,
section_category=section_category,
payment_category=payment_category,
simulation_state=list(self.getPortalFutureInventoryStateList())+\ simulation_state=list(self.getPortalFutureInventoryStateList())+\
list(self.getPortalReservedInventoryStateList())+\ list(self.getPortalReservedInventoryStateList())+\
list(self.getPortalCurrentInventoryStateList()), **kw) list(self.getPortalCurrentInventoryStateList()), **kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getCurrentInventoryList') security.declareProtected(Permissions.AccessContentsInformation, 'getCurrentInventoryList')
def getCurrentInventoryList(self, section = None, node = None, def getCurrentInventoryList(self, section = None, node = None, payment = None,
node_category=None, section_category=None, node_category=None, section_category=None, payment_category = None,
ignore_variation=0, **kw): ignore_variation=0, **kw):
""" """
Returns list of current inventory grouped by section or site Returns list of current inventory grouped by section or site
""" """
if section_category is None: if section_category is None:
section_category = self.getPortalDefaultSectionCategory() section_category = self.getPortalDefaultSectionCategory()
return self.getInventoryList(simulation_state=self.getPortalCurrentInventoryStateList(), section=section, node=node, return self.getInventoryList(simulation_state=self.getPortalCurrentInventoryStateList(), section=section,
node_category=node_category, section_category=section_category, **kw) node=node, payment=payment,
#return self.getInventoryList(at_date=DateTime(), section=section, node=node, node_category=node_category, section_category=section_category,
# node_category=node_category, section_category=section_category, **kw) payment_category=payment_category, **kw)
#return self.getInventoryList(at_date=DateTime(), section=section, node=node, payment=payment
# node_category=node_category, section_category=section_category,
# payment_category=payment_category, **kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getInventoryStat') security.declareProtected(Permissions.AccessContentsInformation, 'getInventoryStat')
def getInventoryStat(self, at_date = None, section = None, node = None, def getInventoryStat(self, at_date = None, section = None, node = None, payment = None,
node_category=None, section_category=None, simulation_state=None, node_category=None, section_category=None, payment_category = None, simulation_state=None,
ignore_variation=0, **kw): ignore_variation=0, **kw):
""" """
Returns statistics of inventory list grouped by section or site Returns statistics of inventory list grouped by section or site
...@@ -1006,40 +1025,43 @@ class Delivery(XMLObject): ...@@ -1006,40 +1025,43 @@ class Delivery(XMLObject):
resource_dict[m.getResource()] = 1 resource_dict[m.getResource()] = 1
result = self.Resource_zGetInventory(resource = resource_dict.keys(), result = self.Resource_zGetInventory(resource = resource_dict.keys(),
to_date=at_date, to_date=at_date,
section=section, node=node, section=section, node=node, payment=payment,
node_category=node_category, node_category=node_category,
section_category=section_category, **kw) section_category=section_category,
payment_category=payment_category, **kw)
return result return result
security.declareProtected(Permissions.AccessContentsInformation, 'getFutureInventoryStat') security.declareProtected(Permissions.AccessContentsInformation, 'getFutureInventoryStat')
def getFutureInventoryStat(self, section = None, node = None, def getFutureInventoryStat(self, section = None, node = None, payment = None,
node_category=None, section_category=None, simulation_state=None, node_category=None, section_category=None, payment_category = None, simulation_state=None,
ignore_variation=0, **kw): ignore_variation=0, **kw):
""" """
Returns statistics of future inventory list grouped by section or site Returns statistics of future inventory list grouped by section or site
""" """
if section_category is None: if section_category is None:
section_category = self.getPortalDefaultSectionCategory() section_category = self.getPortalDefaultSectionCategory()
return self.getInventoryStat(at_date=None, section=section, node=node, return self.getInventoryStat(at_date=None, section=section, node=node, payment=payment,
node_category=node_category, section_category=section_category, **kw) node_category=node_category, section_category=section_category,
payment_category=payment_category, **kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getCurrentInventoryStat') security.declareProtected(Permissions.AccessContentsInformation, 'getCurrentInventoryStat')
def getCurrentInventoryStat(self, section = None, node = None, def getCurrentInventoryStat(self, section = None, node = None, payment = None,
node_category=None, section_category=None, node_category=None, section_category=None, payment_category = None,
ignore_variation=0, **kw): ignore_variation=0, **kw):
""" """
Returns statistics of current inventory list grouped by section or site Returns statistics of current inventory list grouped by section or site
""" """
if section_category is None: if section_category is None:
section_category = self.getPortalDefaultSectionCategory() section_category = self.getPortalDefaultSectionCategory()
return self.getInventoryStat(simulation_state='delivered', section=section, node=node, return self.getInventoryStat(simulation_state='delivered', section=section, node=node, payment=payment,
node_category=node_category, section_category=section_category, **kw) node_category=node_category, section_category=section_category,
#return self.getInventoryStat(at_date=DateTime(), section=section, node=node, payment_category=payment_category, **kw)
# node_category=node_category, section_category=section_category, **kw) #return self.getInventoryStat(at_date=DateTime(), section=section, node=node, payment=payment
# node_category=node_category, section_category=section_category, payment_category=payment_category, **kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getInventoryChart') security.declareProtected(Permissions.AccessContentsInformation, 'getInventoryChart')
def getInventoryChart(self, at_date = None, section = None, node = None, def getInventoryChart(self, at_date = None, section = None, node = None, payment = None,
node_category=None, section_category=None, simulation_state=None, node_category=None, section_category=None, payment_category = None, simulation_state=None,
ignore_variation=0, **kw): ignore_variation=0, **kw):
""" """
Returns list of inventory grouped by section or site Returns list of inventory grouped by section or site
...@@ -1048,41 +1070,47 @@ class Delivery(XMLObject): ...@@ -1048,41 +1070,47 @@ class Delivery(XMLObject):
section_category = self.getPortalDefaultSectionCategory() section_category = self.getPortalDefaultSectionCategory()
if type(simulation_state) is type('a'): if type(simulation_state) is type('a'):
simulation_state = [simulation_state] simulation_state = [simulation_state]
result = self.getInventoryList(at_date=at_date, section=section, node=node, result = self.getInventoryList(at_date=at_date, section=section, node=node, payment=payment,
node_category=node_category, section_category=section_category, node_category=node_category,
section_category=section_category,
payment_category=payment_category,
simulation_state=simulation_state, ignore_variation=ignore_variation, **kw) simulation_state=simulation_state, ignore_variation=ignore_variation, **kw)
return map(lambda r: (r.node_title, r.inventory), result) return map(lambda r: (r.node_title, r.inventory), result)
security.declareProtected(Permissions.AccessContentsInformation, 'getFutureInventoryChart') security.declareProtected(Permissions.AccessContentsInformation, 'getFutureInventoryChart')
def getFutureInventoryChart(self, section = None, node = None, def getFutureInventoryChart(self, section = None, node = None, payment = None,
node_category=None, section_category=None, simulation_state=None, node_category=None, section_category=None, payment_category = None, simulation_state=None,
ignore_variation=0, **kw): ignore_variation=0, **kw):
""" """
Returns list of future inventory grouped by section or site Returns list of future inventory grouped by section or site
""" """
if section_category is None: if section_category is None:
section_category = self.getPortalDefaultSectionCategory() section_category = self.getPortalDefaultSectionCategory()
return self.getInventoryChart(at_date=None, section=section, node=node, return self.getInventoryChart(at_date=None, section=section, node=node, payment=payment,
node_category=node_category, section_category=section_category, **kw) node_category=node_category, section_category=section_category,
payment_category=payment_category, **kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getCurrentInventoryChart') security.declareProtected(Permissions.AccessContentsInformation, 'getCurrentInventoryChart')
def getCurrentInventoryChart(self, section = None, node = None, def getCurrentInventoryChart(self, section = None, node = None, payment = None,
node_category=None, section_category=None, node_category=None, section_category=None, payment_category = None,
ignore_variation=0, **kw): ignore_variation=0, **kw):
""" """
Returns list of current inventory grouped by section or site Returns list of current inventory grouped by section or site
""" """
if section_category is None: if section_category is None:
section_category = self.getPortalDefaultSectionCategory() section_category = self.getPortalDefaultSectionCategory()
return self.getInventoryChart(simulation_state=self.getPortalCurrentInventoryStateList(), section=section, node=node, return self.getInventoryChart(simulation_state=self.getPortalCurrentInventoryStateList(), section=section,
node_category=node_category, section_category=section_category, **kw) node=node, payment=payment,
# return self.getInventoryChart(at_date=DateTime(), section=section, node=node, node_category=node_category, section_category=section_category,
# node_category=node_category, section_category=section_category, **kw) payment_category=payment_category, **kw)
# return self.getInventoryChart(at_date=DateTime(), section=section, node=node, payment=payment,
# node_category=node_category, section_category=section_category,
# payment_category=payment_category, **kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getMovementHistoryList') security.declareProtected(Permissions.AccessContentsInformation, 'getMovementHistoryList')
def getMovementHistoryList(self, from_date = None, to_date=None, section = None, node = None, def getMovementHistoryList(self, from_date = None, to_date=None, section = None, node = None, payment = None,
node_category=None, section_category=None, simulation_state=None, node_category=None, section_category=None, payment_category = None, simulation_state=None,
ignore_variation=0, **kw): ignore_variation=0, **kw):
""" """
Returns list of inventory grouped by section or site Returns list of inventory grouped by section or site
...@@ -1094,13 +1122,15 @@ class Delivery(XMLObject): ...@@ -1094,13 +1122,15 @@ class Delivery(XMLObject):
to_date=to_date, to_date=to_date,
section=section, section=section,
node=node, node=node,
payment=payment,
node_category=node_category, node_category=node_category,
section_category=section_category, **kw) section_category=section_category,
payment_category=payment_category, **kw)
return result return result
security.declareProtected(Permissions.AccessContentsInformation, 'getMovementHistoryStat') security.declareProtected(Permissions.AccessContentsInformation, 'getMovementHistoryStat')
def getMovementHistoryStat(self, from_date = None, to_date=None, section = None, node = None, def getMovementHistoryStat(self, from_date = None, to_date=None, section = None, node = None, payment = None,
node_category=None, section_category=None, simulation_state=None, node_category=None, section_category=None, payment_category = None, simulation_state=None,
ignore_variation=0, **kw): ignore_variation=0, **kw):
""" """
Returns list of inventory grouped by section or site Returns list of inventory grouped by section or site
...@@ -1112,13 +1142,15 @@ class Delivery(XMLObject): ...@@ -1112,13 +1142,15 @@ class Delivery(XMLObject):
to_date=to_date, to_date=to_date,
section=section, section=section,
node=node, node=node,
payment=payment,
node_category=node_category, node_category=node_category,
section_category=section_category, **kw) section_category=section_category,
payment_category=payment_category, **kw)
return result return result
security.declareProtected(Permissions.AccessContentsInformation, 'getInventoryHistoryList') security.declareProtected(Permissions.AccessContentsInformation, 'getInventoryHistoryList')
def getInventoryHistoryList(self, from_date = None, to_date=None, section = None, node = None, def getInventoryHistoryList(self, from_date = None, to_date=None, section = None, node = None, payment = None,
node_category=None, section_category=None, simulation_state=None, node_category=None, section_category=None, payment_category = None, simulation_state=None,
ignore_variation=0, **kw): ignore_variation=0, **kw):
""" """
Returns list of inventory grouped by section or site Returns list of inventory grouped by section or site
...@@ -1131,16 +1163,18 @@ class Delivery(XMLObject): ...@@ -1131,16 +1163,18 @@ class Delivery(XMLObject):
to_date=to_date, to_date=to_date,
section=section, section=section,
node=node, node=node,
payment=payment,
node_category=node_category, node_category=node_category,
section_category=section_category, section_category=section_category,
payment_category=payment_category,
simulation_state = simulation_state, simulation_state = simulation_state,
**kw) **kw)
return result return result
security.declareProtected(Permissions.AccessContentsInformation, 'getInventoryHistoryChart') security.declareProtected(Permissions.AccessContentsInformation, 'getInventoryHistoryChart')
def getInventoryHistoryChart(self, from_date = None, to_date=None, section = None, node = None, def getInventoryHistoryChart(self, from_date = None, to_date=None, section = None, node = None, payment = None,
node_category=None, section_category=None, simulation_state=None, node_category=None, section_category=None, payment_category = None, simulation_state=None,
ignore_variation=0, **kw): ignore_variation=0, **kw):
""" """
Returns list of inventory grouped by section or site Returns list of inventory grouped by section or site
...@@ -1153,8 +1187,10 @@ class Delivery(XMLObject): ...@@ -1153,8 +1187,10 @@ class Delivery(XMLObject):
to_date=to_date, to_date=to_date,
section=section, section=section,
node=node, node=node,
payment=payment,
node_category=node_category, node_category=node_category,
section_category=section_category, section_category=section_category,
payment_category=payment_category,
simulation_state = simulation_state, simulation_state = simulation_state,
**kw) **kw)
return result return result
......
...@@ -205,8 +205,9 @@ class Resource(XMLMatrix, CoreResource, Variated): ...@@ -205,8 +205,9 @@ class Resource(XMLMatrix, CoreResource, Variated):
# Stock Management # Stock Management
security.declareProtected(Permissions.AccessContentsInformation, 'getInventory') security.declareProtected(Permissions.AccessContentsInformation, 'getInventory')
def getInventory(self, at_date = None, section = None, node = None, def getInventory(self, at_date = None, section = None, node = None, payment = None,
node_category=None, section_category=None, simulation_state=None, variation_text=None, node_category=None, section_category=None, payment_category = None,
simulation_state=None, variation_text=None,
ignore_variation=0, **kw): ignore_variation=0, **kw):
if section_category is None: if section_category is None:
section_category = self.getPortalDefaultSectionCategory() section_category = self.getPortalDefaultSectionCategory()
...@@ -215,9 +216,9 @@ class Resource(XMLMatrix, CoreResource, Variated): ...@@ -215,9 +216,9 @@ class Resource(XMLMatrix, CoreResource, Variated):
result = self.Resource_zGetInventory(resource_uid = [self.getUid()], result = self.Resource_zGetInventory(resource_uid = [self.getUid()],
resource=None, resource=None,
to_date=at_date, to_date=at_date,
section=section, node=node, section=section, node=node, payment=payment,
node_category=node_category, node_category=node_category,
section_category=section_category, section_category=section_category, payment_category=payment_category,
simulation_state=simulation_state, simulation_state=simulation_state,
variation_text=variation_text variation_text=variation_text
) )
...@@ -226,24 +227,24 @@ class Resource(XMLMatrix, CoreResource, Variated): ...@@ -226,24 +227,24 @@ class Resource(XMLMatrix, CoreResource, Variated):
return 0.0 return 0.0
security.declareProtected(Permissions.AccessContentsInformation, 'getFutureInventory') security.declareProtected(Permissions.AccessContentsInformation, 'getFutureInventory')
def getFutureInventory(self, section = None, node = None, def getFutureInventory(self, section = None, node = None, payment = None,
node_category=None, section_category=None, simulation_state=None, node_category=None, section_category=None, payment_category = None, simulation_state=None,
ignore_variation=0, **kw): ignore_variation=0, **kw):
""" """
Returns inventory at infinite Returns inventory at infinite
""" """
if section_category is None: if section_category is None:
section_category = self.getPortalDefaultSectionCategory() section_category = self.getPortalDefaultSectionCategory()
return self.getInventory(at_date=None, section=section, node=node, return self.getInventory(at_date=None, section=section, node=node, payment=payment,
node_category=node_category, section_category=section_category, node_category=node_category, section_category=section_category, payment_category=payment_category,
simulation_state=list(self.getPortalFutureInventoryStateList())+ \ simulation_state=list(self.getPortalFutureInventoryStateList())+ \
list(self.getPortalReservedInventoryStateList())+ \ list(self.getPortalReservedInventoryStateList())+ \
list(self.getPortalCurrentInventoryStateList()), list(self.getPortalCurrentInventoryStateList()),
**kw) **kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getCurrentInventory') security.declareProtected(Permissions.AccessContentsInformation, 'getCurrentInventory')
def getCurrentInventory(self, section = None, node = None, def getCurrentInventory(self, section = None, node = None, payment = None,
node_category=None, section_category=None, ignore_variation=0, variation_text=None, **kw): node_category=None, section_category=None, payment_category = None, ignore_variation=0, variation_text=None, **kw):
""" """
Returns current inventory Returns current inventory
""" """
...@@ -252,27 +253,27 @@ class Resource(XMLMatrix, CoreResource, Variated): ...@@ -252,27 +253,27 @@ class Resource(XMLMatrix, CoreResource, Variated):
if section_category is None: if section_category is None:
section_category = self.getPortalDefaultSectionCategory() section_category = self.getPortalDefaultSectionCategory()
return self.getInventory(simulation_state = self.getPortalCurrentInventoryStateList(), return self.getInventory(simulation_state = self.getPortalCurrentInventoryStateList(),
section=section, node=node, section=section, node=node, payment=payment,
node_category=node_category, section_category=section_category, **kw) node_category=node_category, section_category=section_category, payment_category=payment_category, **kw)
#return self.getInventory(at_date=DateTime(), section=section, node=node, #return self.getInventory(at_date=DateTime(), section=section, node=node, payment=payment,
# node_category=node_category, section_category=section_category, **kw) # node_category=node_category, section_category=section_category, payment_category=payment_category, **kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getAvailableInventory') security.declareProtected(Permissions.AccessContentsInformation, 'getAvailableInventory')
def getAvailableInventory(self, section = None, node = None, def getAvailableInventory(self, section = None, node = None, payment = None,
node_category=None, section_category=None, node_category=None, section_category=None, payment_category = None,
ignore_variation=0, **kw): ignore_variation=0, **kw):
""" """
Returns available inventory, ie. current inventory - deliverable Returns available inventory, ie. current inventory - deliverable
""" """
if section_category is None: if section_category is None:
section_category = self.getPortalDefaultSectionCategory() section_category = self.getPortalDefaultSectionCategory()
return self.getInventory(at_date=DateTime(), section=section, node=node, return self.getInventory(at_date=DateTime(), section=section, node=node, payment=payment,
node_category=node_category, section_category=section_category, **kw) node_category=node_category, section_category=section_category, payment_category=payment_category, **kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getInventoryList') security.declareProtected(Permissions.AccessContentsInformation, 'getInventoryList')
def getInventoryList(self, at_date = None, section = None, node = None, def getInventoryList(self, at_date = None, section = None, node = None, payment = None,
node_category=None, section_category=None, simulation_state=None, node_category=None, section_category=None, payment_category = None, simulation_state=None,
ignore_variation=0, **kw): ignore_variation=0, **kw):
""" """
Returns list of inventory grouped by section or site Returns list of inventory grouped by section or site
...@@ -284,16 +285,16 @@ class Resource(XMLMatrix, CoreResource, Variated): ...@@ -284,16 +285,16 @@ class Resource(XMLMatrix, CoreResource, Variated):
result = self.Resource_zGetInventoryList(resource_uid = [self.getUid()], result = self.Resource_zGetInventoryList(resource_uid = [self.getUid()],
resource=None, resource=None,
to_date=at_date, to_date=at_date,
section=section, node=node, section=section, node=node, payment=payment,
node_category=node_category, node_category=node_category,
section_category=section_category, section_category=section_category, payment_category=payment_category,
simulation_state=simulation_state, simulation_state=simulation_state,
**kw) **kw)
return result return result
security.declareProtected(Permissions.AccessContentsInformation, 'getFutureInventoryList') security.declareProtected(Permissions.AccessContentsInformation, 'getFutureInventoryList')
def getFutureInventoryList(self, section = None, node = None, def getFutureInventoryList(self, section = None, node = None, payment = None,
node_category=None, section_category=None, node_category=None, section_category=None, payment_category = None,
simulation_state=None, ignore_variation=0, **kw): simulation_state=None, ignore_variation=0, **kw):
""" """
Returns list of future inventory grouped by section or site Returns list of future inventory grouped by section or site
...@@ -301,16 +302,16 @@ class Resource(XMLMatrix, CoreResource, Variated): ...@@ -301,16 +302,16 @@ class Resource(XMLMatrix, CoreResource, Variated):
if section_category is None: if section_category is None:
section_category = self.getPortalDefaultSectionCategory() section_category = self.getPortalDefaultSectionCategory()
LOG('getFutureInventoryList',0,str(kw)) LOG('getFutureInventoryList',0,str(kw))
return self.getInventoryList(at_date=None, section=section, node=node, return self.getInventoryList(at_date=None, section=section, node=node, payment=payment,
node_category=node_category, section_category=section_category, node_category=node_category, section_category=section_category, payment_category=payment_category,
simulation_state=list(self.getPortalFutureInventoryStateList())+ \ simulation_state=list(self.getPortalFutureInventoryStateList())+ \
list(self.getPortalReservedInventoryStateList())+ \ list(self.getPortalReservedInventoryStateList())+ \
list(self.getPortalCurrentInventoryStateList()), list(self.getPortalCurrentInventoryStateList()),
**kw) **kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getCurrentInventoryList') security.declareProtected(Permissions.AccessContentsInformation, 'getCurrentInventoryList')
def getCurrentInventoryList(self, section = None, node = None, def getCurrentInventoryList(self, section = None, node = None, payment = None,
node_category=None, section_category=None, node_category=None, section_category=None, payment_category = None,
ignore_variation=0, **kw): ignore_variation=0, **kw):
""" """
Returns list of current inventory grouped by section or site Returns list of current inventory grouped by section or site
...@@ -318,14 +319,14 @@ class Resource(XMLMatrix, CoreResource, Variated): ...@@ -318,14 +319,14 @@ class Resource(XMLMatrix, CoreResource, Variated):
if section_category is None: if section_category is None:
section_category = self.getPortalDefaultSectionCategory() section_category = self.getPortalDefaultSectionCategory()
return self.getInventoryList(simulation_state=self.getPortalCurrentInventoryStateList(), return self.getInventoryList(simulation_state=self.getPortalCurrentInventoryStateList(),
section=section, node=node, section=section, node=node, payment=payment,
node_category=node_category, section_category=section_category, **kw) node_category=node_category, section_category=section_category, payment_category=payment_category, **kw)
#return self.getInventoryList(at_date=DateTime(), section=section, node=node, #return self.getInventoryList(at_date=DateTime(), section=section, node=node, payment=payment,
# node_category=node_category, section_category=section_category, **kw) # node_category=node_category, section_category=section_category, payment_category=payment_category, **kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getInventoryStat') security.declareProtected(Permissions.AccessContentsInformation, 'getInventoryStat')
def getInventoryStat(self, at_date = None, section = None, node = None, def getInventoryStat(self, at_date = None, section = None, node = None, payment = None,
node_category=None, section_category=None, node_category=None, section_category=None, payment_category = None,
simulation_state=None, ignore_variation=0, **kw): simulation_state=None, ignore_variation=0, **kw):
""" """
Returns statistics of inventory list grouped by section or site Returns statistics of inventory list grouped by section or site
...@@ -337,32 +338,32 @@ class Resource(XMLMatrix, CoreResource, Variated): ...@@ -337,32 +338,32 @@ class Resource(XMLMatrix, CoreResource, Variated):
result = self.Resource_zGetInventory(resource_uid = [self.getUid()], result = self.Resource_zGetInventory(resource_uid = [self.getUid()],
resource=None, resource=None,
to_date=at_date, to_date=at_date,
section=section, node=node, section=section, node=node, payment=payment,
node_category=node_category, node_category=node_category,
section_category=section_category, section_category=section_category, payment_category=payment_category,
simulation_state=simulation_state, simulation_state=simulation_state,
**kw) **kw)
return result return result
security.declareProtected(Permissions.AccessContentsInformation, 'getFutureInventoryStat') security.declareProtected(Permissions.AccessContentsInformation, 'getFutureInventoryStat')
def getFutureInventoryStat(self, section = None, node = None, def getFutureInventoryStat(self, section = None, node = None, payment = None,
node_category=None, section_category=None, node_category=None, section_category=None, payment_category = None,
simulation_state=None, ignore_variation=0, **kw): simulation_state=None, ignore_variation=0, **kw):
""" """
Returns statistics of future inventory list grouped by section or site Returns statistics of future inventory list grouped by section or site
""" """
if section_category is None: if section_category is None:
section_category = self.getPortalDefaultSectionCategory() section_category = self.getPortalDefaultSectionCategory()
return self.getInventoryStat(at_date=None, section=section, node=node, return self.getInventoryStat(at_date=None, section=section, node=node, payment=payment,
node_category=node_category, section_category=section_category, node_category=node_category, section_category=section_category, payment_category=payment_category,
simulation_state=list(self.getPortalFutureInventoryStateList())+ \ simulation_state=list(self.getPortalFutureInventoryStateList())+ \
list(self.getPortalReservedInventoryStateList())+ \ list(self.getPortalReservedInventoryStateList())+ \
list(self.getPortalCurrentInventoryStateList()), list(self.getPortalCurrentInventoryStateList()),
**kw) **kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getCurrentInventoryStat') security.declareProtected(Permissions.AccessContentsInformation, 'getCurrentInventoryStat')
def getCurrentInventoryStat(self, section = None, node = None, def getCurrentInventoryStat(self, section = None, node = None, payment = None,
node_category=None, section_category=None, node_category=None, section_category=None, payment_category = None,
ignore_variation=0, **kw): ignore_variation=0, **kw):
""" """
Returns statistics of current inventory list grouped by section or site Returns statistics of current inventory list grouped by section or site
...@@ -370,12 +371,12 @@ class Resource(XMLMatrix, CoreResource, Variated): ...@@ -370,12 +371,12 @@ class Resource(XMLMatrix, CoreResource, Variated):
if section_category is None: if section_category is None:
section_category = self.getPortalDefaultSectionCategory() section_category = self.getPortalDefaultSectionCategory()
return self.getInventoryStat(simulation_state=self.getPortalCurrentInventoryStateList(), return self.getInventoryStat(simulation_state=self.getPortalCurrentInventoryStateList(),
section=section, node=node, section=section, node=node, payment=payment,
node_category=node_category, section_category=section_category, **kw) node_category=node_category, section_category=section_category, payment_category=payment_category, **kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getInventoryChart') security.declareProtected(Permissions.AccessContentsInformation, 'getInventoryChart')
def getInventoryChart(self, at_date = None, section = None, node = None, def getInventoryChart(self, at_date = None, section = None, node = None, payment = None,
node_category=None, section_category=None, simulation_state=None, node_category=None, section_category=None, payment_category = None, simulation_state=None,
ignore_variation=0, **kw): ignore_variation=0, **kw):
""" """
Returns list of inventory grouped by section or site Returns list of inventory grouped by section or site
...@@ -387,32 +388,32 @@ class Resource(XMLMatrix, CoreResource, Variated): ...@@ -387,32 +388,32 @@ class Resource(XMLMatrix, CoreResource, Variated):
result = self.Resource_zGetInventoryList(resource_uid = [self.getUid()], result = self.Resource_zGetInventoryList(resource_uid = [self.getUid()],
resource=None, resource=None,
to_date=at_date, to_date=at_date,
section=section, node=node, section=section, node=node, payment=payment,
node_category=node_category, node_category=node_category,
section_category=section_category, section_category=section_category, payment_category=payment_category,
simulation_state=simulation_state, simulation_state=simulation_state,
**kw) **kw)
return map(lambda r: (r.node_title, r.inventory), result) return map(lambda r: (r.node_title, r.inventory), result)
security.declareProtected(Permissions.AccessContentsInformation, 'getFutureInventoryChart') security.declareProtected(Permissions.AccessContentsInformation, 'getFutureInventoryChart')
def getFutureInventoryChart(self, section = None, node = None, def getFutureInventoryChart(self, section = None, node = None, payment = None,
node_category=None, section_category=None, node_category=None, section_category=None, payment_category = None,
simulation_state=None, ignore_variation=0, **kw): simulation_state=None, ignore_variation=0, **kw):
""" """
Returns list of future inventory grouped by section or site Returns list of future inventory grouped by section or site
""" """
if section_category is None: if section_category is None:
section_category = self.getPortalDefaultSectionCategory() section_category = self.getPortalDefaultSectionCategory()
return self.getInventoryChart(at_date=None, section=section, node=node, return self.getInventoryChart(at_date=None, section=section, node=node, payment=payment,
node_category=node_category, section_category=section_category, node_category=node_category, section_category=section_category, payment_category=payment_category,
simulation_state=list(self.getPortalFutureInventoryStateList())+ \ simulation_state=list(self.getPortalFutureInventoryStateList())+ \
list(self.getPortalReservedInventoryStateList())+ \ list(self.getPortalReservedInventoryStateList())+ \
list(self.getPortalCurrentInventoryStateList()), list(self.getPortalCurrentInventoryStateList()),
**kw) **kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getCurrentInventoryChart') security.declareProtected(Permissions.AccessContentsInformation, 'getCurrentInventoryChart')
def getCurrentInventoryChart(self, section = None, node = None, def getCurrentInventoryChart(self, section = None, node = None, payment = None,
node_category=None, section_category=None, node_category=None, section_category=None, payment_category = None,
ignore_variation=0, **kw): ignore_variation=0, **kw):
""" """
Returns list of current inventory grouped by section or site Returns list of current inventory grouped by section or site
...@@ -420,15 +421,15 @@ class Resource(XMLMatrix, CoreResource, Variated): ...@@ -420,15 +421,15 @@ class Resource(XMLMatrix, CoreResource, Variated):
if section_category is None: if section_category is None:
section_category = self.getPortalDefaultSectionCategory() section_category = self.getPortalDefaultSectionCategory()
return self.getInventoryChart(simulation_state=self.getPortalCurrentInventoryStateList(), return self.getInventoryChart(simulation_state=self.getPortalCurrentInventoryStateList(),
section=section, node=node, section=section, node=node, payment=payment,
node_category=node_category, section_category=section_category, **kw) node_category=node_category, section_category=section_category, payment_category=payment_category, **kw)
#return self.getInventoryChart(at_date=DateTime(), section=section, node=node, #return self.getInventoryChart(at_date=DateTime(), section=section, node=node, payment=payment,
# node_category=node_category, section_category=section_category, **kw) # node_category=node_category, section_category=section_category, payment_category=payment_category, **kw)
security.declareProtected(Permissions.AccessContentsInformation, 'getMovementHistoryList') security.declareProtected(Permissions.AccessContentsInformation, 'getMovementHistoryList')
def getMovementHistoryList(self, from_date = None, to_date=None, section = None, node = None, def getMovementHistoryList(self, from_date = None, to_date=None, section = None, node = None, payment = None,
node_category=None, section_category=None, simulation_state=None, node_category=None, section_category=None, payment_category = None, simulation_state=None,
ignore_variation=0, **kw): ignore_variation=0, **kw):
""" """
Returns list of inventory grouped by section or site Returns list of inventory grouped by section or site
...@@ -440,16 +441,16 @@ class Resource(XMLMatrix, CoreResource, Variated): ...@@ -440,16 +441,16 @@ class Resource(XMLMatrix, CoreResource, Variated):
from_date=from_date, from_date=from_date,
to_date=to_date, to_date=to_date,
section=section, section=section,
node=node, node=node, payment=payment,
node_category=node_category, node_category=node_category,
section_category=section_category, section_category=section_category, payment_category=payment_category,
simulation_state=simulation_state, simulation_state=simulation_state,
**kw) **kw)
return result return result
security.declareProtected(Permissions.AccessContentsInformation, 'getMovementHistoryStat') security.declareProtected(Permissions.AccessContentsInformation, 'getMovementHistoryStat')
def getMovementHistoryStat(self, from_date = None, to_date=None, section = None, node = None, def getMovementHistoryStat(self, from_date = None, to_date=None, section = None, node = None, payment = None,
node_category=None, section_category=None, simulation_state=None, node_category=None, section_category=None, payment_category = None, simulation_state=None,
ignore_variation=0, **kw): ignore_variation=0, **kw):
""" """
Returns list of inventory grouped by section or site Returns list of inventory grouped by section or site
...@@ -461,15 +462,15 @@ class Resource(XMLMatrix, CoreResource, Variated): ...@@ -461,15 +462,15 @@ class Resource(XMLMatrix, CoreResource, Variated):
from_date=from_date, from_date=from_date,
to_date=to_date, to_date=to_date,
section=section, section=section,
node=node, node=node, payment=payment,
node_category=node_category, node_category=node_category,
simulation_state=simulation_state, simulation_state=simulation_state,
section_category=section_category, **kw) section_category=section_category, payment_category=payment_category, **kw)
return result return result
security.declareProtected(Permissions.AccessContentsInformation, 'getInventoryHistoryList') security.declareProtected(Permissions.AccessContentsInformation, 'getInventoryHistoryList')
def getInventoryHistoryList(self, from_date = None, to_date=None, section = None, node = None, def getInventoryHistoryList(self, from_date = None, to_date=None, section = None, node = None, payment = None,
node_category=None, section_category=None, simulation_state=None, node_category=None, section_category=None, payment_category = None, simulation_state=None,
ignore_variation=0, **kw): ignore_variation=0, **kw):
""" """
Returns list of inventory grouped by section or site Returns list of inventory grouped by section or site
...@@ -482,17 +483,17 @@ class Resource(XMLMatrix, CoreResource, Variated): ...@@ -482,17 +483,17 @@ class Resource(XMLMatrix, CoreResource, Variated):
from_date=from_date, from_date=from_date,
to_date=to_date, to_date=to_date,
section=section, section=section,
node=node, node=node, payment=payment,
node_category=node_category, node_category=node_category,
section_category=section_category, section_category=section_category, payment_category=payment_category,
simulation_state = simulation_state, simulation_state = simulation_state,
**kw) **kw)
return result return result
security.declareProtected(Permissions.AccessContentsInformation, 'getInventoryHistoryChart') security.declareProtected(Permissions.AccessContentsInformation, 'getInventoryHistoryChart')
def getInventoryHistoryChart(self, from_date = None, to_date=None, section = None, node = None, def getInventoryHistoryChart(self, from_date = None, to_date=None, section = None, node = None, payment = None,
node_category=None, section_category=None, simulation_state=None, node_category=None, section_category=None, payment_category = None, simulation_state=None,
ignore_variation=0, **kw): ignore_variation=0, **kw):
""" """
Returns list of inventory grouped by section or site Returns list of inventory grouped by section or site
...@@ -505,17 +506,17 @@ class Resource(XMLMatrix, CoreResource, Variated): ...@@ -505,17 +506,17 @@ class Resource(XMLMatrix, CoreResource, Variated):
from_date=from_date, from_date=from_date,
to_date=to_date, to_date=to_date,
section=section, section=section,
node=node, node=node, payment=payment,
node_category=node_category, node_category=node_category,
section_category=section_category, section_category=section_category, payment_category=payment_category,
simulation_state = simulation_state, simulation_state = simulation_state,
**kw) **kw)
return result return result
security.declareProtected(Permissions.AccessContentsInformation, 'getNextNegativeInventoryDate') security.declareProtected(Permissions.AccessContentsInformation, 'getNextNegativeInventoryDate')
def getNextNegativeInventoryDate(self, from_date = None, section = None, node = None, def getNextNegativeInventoryDate(self, from_date = None, section = None, node = None, payment = None,
node_category=None, section_category=None, simulation_state=None, node_category=None, section_category=None, payment_category = None, simulation_state=None,
variation_text = None, variation_text = None,
ignore_variation=0, **kw): ignore_variation=0, **kw):
""" """
...@@ -530,9 +531,10 @@ class Resource(XMLMatrix, CoreResource, Variated): ...@@ -530,9 +531,10 @@ class Resource(XMLMatrix, CoreResource, Variated):
from_date=from_date, from_date=from_date,
variation_text = variation_text, variation_text = variation_text,
section=section, section=section,
node=node, node=node, payment=payment,
node_category=node_category, node_category=node_category,
section_category=section_category, section_category=section_category,
payment_category=payment_category,
simulation_state = simulation_state, simulation_state = simulation_state,
**kw) **kw)
for inventory in result: for inventory in result:
......
...@@ -127,6 +127,8 @@ portal_simulated_movement_type_list = tuple(filter(lambda x: x != 'Container Lin ...@@ -127,6 +127,8 @@ portal_simulated_movement_type_list = tuple(filter(lambda x: x != 'Container Lin
portal_container_type_list = ('Container',) portal_container_type_list = ('Container',)
portal_container_line_type_list = ('Container Line',)
portal_item_type_list = ('Piece Tissu','Nexedi VPN') portal_item_type_list = ('Piece Tissu','Nexedi VPN')
portal_discount_type_list = ('Remise',) portal_discount_type_list = ('Remise',)
......
...@@ -347,6 +347,13 @@ class ERP5Site ( CMFSite, FolderMixIn ): ...@@ -347,6 +347,13 @@ class ERP5Site ( CMFSite, FolderMixIn ):
""" """
return self._getPortalConfiguration('portal_container_type_list') return self._getPortalConfiguration('portal_container_type_list')
security.declareProtected(Permissions.AccessContentsInformation, 'getPortalContainerLineTypeList')
def getPortalContainerLineTypeList(self):
"""
Return container line types.
"""
return self._getPortalConfiguration('portal_container_line_type_list')
security.declareProtected(Permissions.AccessContentsInformation, 'getPortalItemTypeList') security.declareProtected(Permissions.AccessContentsInformation, 'getPortalItemTypeList')
def getPortalItemTypeList(self): def getPortalItemTypeList(self):
""" """
......
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