Commit 164a1570 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Completed asset price API for accounting


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4916 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 24b0f7a5
...@@ -185,4 +185,22 @@ class AccountingTransactionLine(DeliveryLine): ...@@ -185,4 +185,22 @@ class AccountingTransactionLine(DeliveryLine):
source.getPriceCurrencyValue()) source.getPriceCurrencyValue())
return None return None
security.declareProtected(Permissions.AccessContentsInformation, 'getSourceAssetPrice')
def getSourceAssetPrice(self):
"""
The price is set to 1.0 because we do not want to implement automatic currency
conversion in accounting. Users must define the conversion manually in accounting.
This is required by accounting law. One can not account USD (in a EUR based company)
without defining the equivalent in EUR.
"""
return 1.0
security.declareProtected(Permissions.AccessContentsInformation, 'getDestinationAssetPrice')
def getDestinationAssetPrice(self):
"""
The price is set to 1.0 because we do not want to implement automatic currency
conversion in accounting. Users must define the conversion manually in accounting.
This is required by accounting law. One can not account USD (in a EUR based company)
without defining the equivalent in EUR.
"""
return 1.0
\ No newline at end of file
...@@ -287,7 +287,7 @@ class Movement(XMLObject, Amount): ...@@ -287,7 +287,7 @@ class Movement(XMLObject, Amount):
if quantity > 0.0: if quantity > 0.0:
return None # Outgoing quantity return None # Outgoing quantity
elif quantity < 0.0: elif quantity < 0.0:
return self.getPrice() * quantity # XXX: price should be converted to the source currency return self.getSourceAssetPrice() * quantity # XXX: price should be converted to the source currency
return None return None
security.declareProtected(Permissions.AccessContentsInformation, 'getDestinationInventoriatedTotalAssetPrice') security.declareProtected(Permissions.AccessContentsInformation, 'getDestinationInventoriatedTotalAssetPrice')
...@@ -304,9 +304,25 @@ class Movement(XMLObject, Amount): ...@@ -304,9 +304,25 @@ class Movement(XMLObject, Amount):
if quantity < 0.0: if quantity < 0.0:
return None # Outgoing quantity return None # Outgoing quantity
elif quantity > 0.0: elif quantity > 0.0:
return self.getPrice() * quantity # XXX: price should be converted to the dest. currency return self.getDestinationAssetPrice() * quantity # XXX: price should be converted to the dest. currency
return None return None
security.declareProtected(Permissions.AccessContentsInformation, 'getSourceAssetPrice')
def getSourceAssetPrice(self):
"""
Returns the price converted to the currency of the source section
This will be implemted by calling currency conversion on currency resources
"""
return self.getPrice() # XXX Not implemented yet
security.declareProtected(Permissions.AccessContentsInformation, 'getDestinationAssetPrice')
def getDestinationAssetPrice(self):
"""
Returns the price converted to the currency of the destination section
"""
return self.getPrice() # XXX Not implemented yet
# Causality computation # Causality computation
security.declareProtected(Permissions.View, 'isConvergent') security.declareProtected(Permissions.View, 'isConvergent')
def isConvergent(self): def isConvergent(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