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

wrap lines to 80 chars.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5572 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a3ac177b
...@@ -40,15 +40,18 @@ from zLOG import LOG ...@@ -40,15 +40,18 @@ from zLOG import LOG
class Container(Movement, XMLObject): class Container(Movement, XMLObject):
""" """
Container is equivalent to a movement with qty 1.0 and resource = to the kind of packaging Container is equivalent to a movement with qty 1.0 and resource =
Container may point to item (ex. Container serial No or Parcel Serial No if tracing required) to the kind of packaging Container may point to item (ex.
Container may eventually usa optional property sheet to store parcel No information (we use Container serial No or Parcel Serial No if tracing required)
Item property sheet for that). Some acquisition may be required... Container may eventually usa optional property sheet to store
parcel No information (we use Item property sheet for that). Some
acquisition may be required...
A Container which does not point to an Item can act itself as an Item A Container which does not point to an Item can act itself as an Item
for traceability. for traceability.
Container Line / Container Cell is used to store quantities (never accounted) Container Line / Container Cell is used to store quantities (never
accounted)
Container Line / Countainer Cell may point to Item Container Line / Countainer Cell may point to Item
""" """
...@@ -78,14 +81,16 @@ class Container(Movement, XMLObject): ...@@ -78,14 +81,16 @@ class Container(Movement, XMLObject):
, PropertySheet.SortIndex , PropertySheet.SortIndex
) )
security.declareProtected(Permissions.AccessContentsInformation, 'getQuantity') security.declareProtected(Permissions.AccessContentsInformation,
'getQuantity')
def getQuantity(self): def getQuantity(self):
""" """
Returns 1 because only one container is shipped Returns 1 because only one container is shipped
""" """
return 1.0 return 1.0
security.declareProtected(Permissions.AccessContentsInformation, 'isAccountable') security.declareProtected(Permissions.AccessContentsInformation,
'isAccountable')
def isAccountable(self): def isAccountable(self):
""" """
Returns 1 if this needs to be accounted Returns 1 if this needs to be accounted
...@@ -95,7 +100,8 @@ class Container(Movement, XMLObject): ...@@ -95,7 +100,8 @@ class Container(Movement, XMLObject):
# Always accountable - to account the containers which we use # Always accountable - to account the containers which we use
return 1 return 1
security.declareProtected( Permissions.ModifyPortalContent, 'hasCellContent' ) security.declareProtected( Permissions.ModifyPortalContent,
'hasCellContent' )
def hasCellContent(self, base_id='movement'): def hasCellContent(self, base_id='movement'):
""" """
This method can be overriden This method can be overriden
...@@ -139,47 +145,57 @@ class Container(Movement, XMLObject): ...@@ -139,47 +145,57 @@ class Container(Movement, XMLObject):
return result return result
# Used for optimization - requires reindexing using container_uid # Used for optimization - requires reindexing using container_uid
security.declareProtected(Permissions.AccessContentsInformation, 'getContainerUid') security.declareProtected(Permissions.AccessContentsInformation,
'getContainerUid')
def getContainerUid(self): def getContainerUid(self):
return self.getUid() return self.getUid()
security.declareProtected(Permissions.AccessContentsInformation, 'getContainerValue') security.declareProtected(Permissions.AccessContentsInformation,
'getContainerValue')
def getContainerValue(self): def getContainerValue(self):
return self return self
security.declareProtected(Permissions.AccessContentsInformation, 'getContainer') security.declareProtected(Permissions.AccessContentsInformation,
'getContainer')
def getContainer(self): def getContainer(self):
return self.getRelativeUrl() return self.getRelativeUrl()
# Quantity methods # Quantity methods
security.declareProtected(Permissions.AccessContentsInformation, 'getContainer') security.declareProtected(Permissions.AccessContentsInformation,
'getContainedTotalQuantity')
def getContainedTotalQuantity(self, recursive = 0): def getContainedTotalQuantity(self, recursive = 0):
""" """
The sum of quantities of contained lines The sum of quantities of contained lines
""" """
result = 0.0 result = 0.0
for o in self.contentValues(filter = {'portal_type': self.getPortalContainerLineTypeList()}): for o in self.contentValues(filter =
{'portal_type': self.getPortalContainerLineTypeList()}):
result += o.getTotalQuantity() result += o.getTotalQuantity()
if recursive: if recursive:
for o in self.contentValues(filter = {'portal_type': self.getPortalContainerTypeList()}): for o in self.contentValues(filter =
result += o.getContainedTotalQuantity() {'portal_type': self.getPortalContainerTypeList()}):
return result result += o.getContainedTotalQuantity()
return result
security.declareProtected(Permissions.AccessContentsInformation, 'getContainer') security.declareProtected(Permissions.AccessContentsInformation,
'getContainedTotalPrice')
def getContainedTotalPrice(self, recursive = 0): def getContainedTotalPrice(self, recursive = 0):
""" """
The sum of price of contained lines The sum of price of contained lines
""" """
result = 0.0 result = 0.0
for o in self.contentValues(filter = {'portal_type': self.getPortalContainerLineTypeList()}): for o in self.contentValues(filter =
{'portal_type': self.getPortalContainerLineTypeList()}):
result += o.getTotalPrice() result += o.getTotalPrice()
if recursive: if recursive:
for o in self.contentValues(filter = {'portal_type': self.getPortalContainerTypeList()}): for o in self.contentValues(filter =
result += o.getContainedTotalPrice() {'portal_type': self.getPortalContainerTypeList()}):
return result result += o.getContainedTotalPrice()
return result
# Item Access # Item Access
security.declareProtected(Permissions.AccessContentsInformation, 'getTrackedItemUidList') security.declareProtected(Permissions.AccessContentsInformation,
'getTrackedItemUidList')
def getTrackedItemUidList(self): def getTrackedItemUidList(self):
""" """
Return a list of uid for related items. Return a list of uid for related items.
......
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