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
This diff is collapsed.
This diff is collapsed.
...@@ -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