Commit dba1da0e authored by Jean-Paul Smets's avatar Jean-Paul Smets

Added tracking API


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3017 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent fe610fe5
......@@ -44,6 +44,9 @@ class Container(Movement, XMLObject):
Container may point to item (ex. Container serial No or Parcel Serial No if tracing 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
for traceability.
Container Line / Container Cell is used to store quantities (never accounted)
Container Line / Countainer Cell may point to Item
......@@ -238,4 +241,16 @@ Une ligne tarifaire."""
result += o.getContainedTotalPrice()
return result
\ No newline at end of file
# Item Access
security.declareProtected(Permissions.AccessContentsInformation, 'getTrackedItemUidList')
def getTrackedItemUidList(self):
"""
Return a list of uid for related items.
If this container is related to no item, it is treated as an Item
"""
### XXX We should filter by portal type here
item_uid_list = self.getAggregateUidList()
if len(item_uid_list): return item_uid_list
return (self.getUid(),)
\ No newline at end of file
......@@ -261,7 +261,33 @@ class Movement(XMLObject, Amount):
return resource.getIndustrialPrice(context=self)
return None
# Asset price calculation
# Asset price calculation
security.declareProtected(Permissions.AccessContentsInformation, 'getSourceAssetPrice')
def getSourceAssetPrice(self):
"""
Asset price is used for calculation of inventory asset value
and for accounting
"""
result = self._baseGetSourceAssetPrice()
if result is not None: return result
if quantity > 0.0:
return None
elif quantity < 0.0:
return self.getPrice()
security.declareProtected(Permissions.AccessContentsInformation, 'getDestinationAssetPrice')
def getDestinationAssetPrice(self):
"""
Asset price is used for calculation of inventory asset value
and for accounting
"""
result = self._baseGetDestinationAssetPrice()
if result is not None: return result
if quantity < 0.0:
return None
elif quantity > 0.0:
return self.getPrice()
security.declareProtected(Permissions.AccessContentsInformation, 'getSourceTotalAssetPrice')
def getSourceTotalAssetPrice(self):
"""
......@@ -590,27 +616,40 @@ class Movement(XMLObject, Amount):
"""
return
# SKU vs. CU
security.declareProtected(Permissions.AccessContentsInformation, 'getSourceStandardInventoriatedQuantity')
def getSourceStandardInventoriatedQuantity(self):
"""
The inventoriated quantity converted in a default unit
For assortments, returns the inventoriated quantity in terms of number of items
in the assortemnt.
For accounting, returns the quantity converted in a default unit
"""
return self.getStandardInventoriatedQuantity()
security.declareProtected(Permissions.AccessContentsInformation, 'getDestinationStandardInventoriatedQuantity')
def getDestinationStandardInventoriatedQuantity(self):
# Item Access (tracking)
security.declareProtected(Permissions.AccessContentsInformation, 'getTrackedItemUidList')
def getTrackedItemUidList(self):
"""
The inventoriated quantity converted in a default unit
For assortments, returns the inventoriated quantity in terms of number of items
in the assortemnt.
For accounting, returns the quantity converted in a default unit
Return a list of uid for related items
"""
return self.getStandardInventoriatedQuantity()
### XXX We should filter by portal type here
return self.getAggregateUidList()
# SKU vs. CU
# security.declareProtected(Permissions.AccessContentsInformation, 'getSourceStandardInventoriatedQuantity')
# def getSourceStandardInventoriatedQuantity(self):
# """
# The inventoriated quantity converted in a default unit
#
# For assortments, returns the inventoriated quantity in terms of number of items
# in the assortemnt.
#
# For accounting, returns the quantity converted in a default unit
# """
# return self.getStandardInventoriatedQuantity()
#
# security.declareProtected(Permissions.AccessContentsInformation, 'getDestinationStandardInventoriatedQuantity')
# def getDestinationStandardInventoriatedQuantity(self):
# """
# The inventoriated quantity converted in a default unit
#
# For assortments, returns the inventoriated quantity in terms of number of items
# in the assortemnt.
#
# For accounting, returns the quantity converted in a default unit
# """
# return self.getStandardInventoriatedQuantity()
#
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