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

Extended API for debit and credit asset price


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4914 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a8dc50cf
...@@ -581,6 +581,60 @@ class Movement(XMLObject, Amount): ...@@ -581,6 +581,60 @@ class Movement(XMLObject, Amount):
""" """
return return
# Debit and credit methods for asset
security.declareProtected(Permissions.AccessContentsInformation, 'getSourceAssetDebit')
def getSourceAssetDebit(self):
"""
Return the debit part of the source total asset price.
This is the same as getSourceDebit where quantity is replaced
by source_total_asset_price
"""
quantity = self.getSourceTotalAssetPrice()
try:
quantity = float(quantity)
except TypeError:
quantity = 0.0
if quantity < 0:
return - quantity
else:
return 0.0
security.declareProtected(Permissions.AccessContentsInformation, 'getSourceAssetCredit')
def getSourceAssetCredit(self):
"""
Return
"""
quantity = self.getSourceTotalAssetPrice()
try:
quantity = float(quantity)
except TypeError:
quantity = 0.0
if quantity < 0:
return 0.0
else:
return quantity
# MISSING
# getDestinationAssetDebit getDestinationAssetCredit
security.declareProtected(Permissions.ModifyPortalContent, 'setSourceAssetDebit')
def setSourceAssetDebit(self, source_debit):
"""
Set the quantity
"""
if source_debit in (None, ''):
return 0.0
try:
source_debit = float(source_debit)
except TypeError:
source_debit = 0.0
self.setSourceTotalAssetPrice(- source_debit)
# MISSING
# setSourceAssetDebit setSourceAssetCredit
# setDestinationAssetDebit setDestinationAssetCredit
# Item Access (tracking) # Item Access (tracking)
security.declareProtected(Permissions.AccessContentsInformation, 'getTrackedItemUidList') security.declareProtected(Permissions.AccessContentsInformation, 'getTrackedItemUidList')
def getTrackedItemUidList(self): def getTrackedItemUidList(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