Commit 5013c9f1 authored by Jean-Paul Smets's avatar Jean-Paul Smets

movement debit/credit methods to movement


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@2630 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3259f84e
...@@ -119,86 +119,6 @@ Une ligne tarifaire.""" ...@@ -119,86 +119,6 @@ Une ligne tarifaire."""
} }
security.declareProtected(Permissions.AccessContentsInformation, 'getSourceDebit')
def getSourceDebit(self):
"""
Return the quantity
"""
quantity = self.getQuantity()
try:
quantity = float(quantity)
except:
quantity = 0.0
if quantity < 0:
return - quantity
else:
return 0.0
security.declareProtected(Permissions.AccessContentsInformation, 'getSourceCredit')
def getSourceCredit(self):
"""
Return the quantity
"""
quantity = self.getQuantity()
try:
quantity = float(quantity)
except:
quantity = 0.0
if quantity < 0:
return 0.0
else:
return quantity
security.declareProtected(Permissions.AccessContentsInformation, 'getDestinationDebit')
getDestinationDebit = getSourceCredit
security.declareProtected(Permissions.AccessContentsInformation, 'getDestinationCredit')
getDestinationCredit = getSourceDebit
security.declareProtected(Permissions.ModifyPortalContent, 'setSourceDebit')
def setSourceDebit(self, source_debit):
"""
Set the quantity
"""
if source_debit in (None, ''):
return 0.0
try:
source_debit = float(source_debit)
except:
source_debit = 0.0
self.setQuantity(- source_debit)
security.declareProtected(Permissions.ModifyPortalContent, 'setSourceCredit')
def setSourceCredit(self, source_credit):
"""
Set the quantity
"""
if source_credit in (None, ''):
return 0.0
try:
source_credit = float(source_credit)
except:
source_credit = 0.0
self.setQuantity(source_credit)
security.declareProtected(Permissions.ModifyPortalContent, 'setDestinationDebit')
def setDestinationDebit(self, destination_debit):
"""
Temp
"""
return
security.declareProtected(Permissions.ModifyPortalContent, 'setDestinationCredit')
def setDestinationCredit(self, destination_credit):
"""
Temp
"""
return
security.declarePrivate('_setSource') security.declarePrivate('_setSource')
def _setSource(self, value): def _setSource(self, value):
self._setCategoryMembership('source', value, base=0) self._setCategoryMembership('source', value, base=0)
...@@ -273,3 +193,42 @@ Une ligne tarifaire.""" ...@@ -273,3 +193,42 @@ Une ligne tarifaire."""
Get the stop date. Get the stop date.
""" """
return self.getStopDate() return self.getStopDate()
# 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
"""
result = self.getInventoriatedQuantity()
resource = self.getResourceValue()
source = self.getSourceValue()
if source is not None and resource is not None:
return resource.convertCurrency(result, source.getPriceCurrencyValue())
return None
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
"""
result = self.getInventoriatedQuantity()
resource = self.getResourceValue()
destination = self.getSourceValue()
if destination is not None and resource is not None:
return resource.convertCurrency(result, destination.getPriceCurrencyValue())
return None
\ No newline at end of file
...@@ -547,5 +547,109 @@ a service in a public administration).""" ...@@ -547,5 +547,109 @@ a service in a public administration)."""
return self.getDestinationSectionList() return self.getDestinationSectionList()
# Debit and credit methods
security.declareProtected(Permissions.AccessContentsInformation, 'getSourceDebit')
def getSourceDebit(self):
"""
Return the quantity
"""
quantity = self.getQuantity()
try:
quantity = float(quantity)
except:
quantity = 0.0
if quantity < 0:
return - quantity
else:
return 0.0
security.declareProtected(Permissions.AccessContentsInformation, 'getSourceCredit')
def getSourceCredit(self):
"""
Return the quantity
"""
quantity = self.getQuantity()
try:
quantity = float(quantity)
except:
quantity = 0.0
if quantity < 0:
return 0.0
else:
return quantity
security.declareProtected(Permissions.AccessContentsInformation, 'getDestinationDebit')
getDestinationDebit = getSourceCredit
security.declareProtected(Permissions.AccessContentsInformation, 'getDestinationCredit')
getDestinationCredit = getSourceDebit
security.declareProtected(Permissions.ModifyPortalContent, 'setSourceDebit')
def setSourceDebit(self, source_debit):
"""
Set the quantity
"""
if source_debit in (None, ''):
return 0.0
try:
source_debit = float(source_debit)
except:
source_debit = 0.0
self.setQuantity(- source_debit)
security.declareProtected(Permissions.ModifyPortalContent, 'setSourceCredit')
def setSourceCredit(self, source_credit):
"""
Set the quantity
"""
if source_credit in (None, ''):
return 0.0
try:
source_credit = float(source_credit)
except:
source_credit = 0.0
self.setQuantity(source_credit)
security.declareProtected(Permissions.ModifyPortalContent, 'setDestinationDebit')
def setDestinationDebit(self, destination_debit):
"""
Temp
"""
return
security.declareProtected(Permissions.ModifyPortalContent, 'setDestinationCredit')
def setDestinationCredit(self, destination_credit):
"""
Temp
"""
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):
"""
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