Commit daea76bb authored by Kevin Deldycke's avatar Kevin Deldycke

missing quantity value initialisation


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3186 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 78292bd5
...@@ -261,7 +261,7 @@ class Movement(XMLObject, Amount): ...@@ -261,7 +261,7 @@ class Movement(XMLObject, Amount):
return resource.getIndustrialPrice(context=self) return resource.getIndustrialPrice(context=self)
return None return None
# Asset price calculation # Asset price calculation
security.declareProtected(Permissions.AccessContentsInformation, 'getSourceAssetPrice') security.declareProtected(Permissions.AccessContentsInformation, 'getSourceAssetPrice')
def getSourceAssetPrice(self): def getSourceAssetPrice(self):
""" """
...@@ -270,11 +270,12 @@ class Movement(XMLObject, Amount): ...@@ -270,11 +270,12 @@ class Movement(XMLObject, Amount):
""" """
result = self._baseGetSourceAssetPrice() result = self._baseGetSourceAssetPrice()
if result is not None: return result if result is not None: return result
quantity = self.getQuantity()
if quantity > 0.0: if quantity > 0.0:
return None return None
elif quantity < 0.0: elif quantity < 0.0:
return self.getPrice() return self.getPrice()
security.declareProtected(Permissions.AccessContentsInformation, 'getDestinationAssetPrice') security.declareProtected(Permissions.AccessContentsInformation, 'getDestinationAssetPrice')
def getDestinationAssetPrice(self): def getDestinationAssetPrice(self):
""" """
...@@ -283,11 +284,12 @@ class Movement(XMLObject, Amount): ...@@ -283,11 +284,12 @@ class Movement(XMLObject, Amount):
""" """
result = self._baseGetDestinationAssetPrice() result = self._baseGetDestinationAssetPrice()
if result is not None: return result if result is not None: return result
quantity = self.getQuantity()
if quantity < 0.0: if quantity < 0.0:
return None return None
elif quantity > 0.0: elif quantity > 0.0:
return self.getPrice() return self.getPrice()
security.declareProtected(Permissions.AccessContentsInformation, 'getSourceTotalAssetPrice') security.declareProtected(Permissions.AccessContentsInformation, 'getSourceTotalAssetPrice')
def getSourceTotalAssetPrice(self): def getSourceTotalAssetPrice(self):
""" """
...@@ -352,11 +354,11 @@ class Movement(XMLObject, Amount): ...@@ -352,11 +354,11 @@ class Movement(XMLObject, Amount):
# self.applyDeliverySolver(dsolver) # self.applyDeliverySolver(dsolver)
# if tsolver is not None: # if tsolver is not None:
# self.applyTargetSolver(tsolver) # self.applyTargetSolver(tsolver)
# #
# security.declareProtected(Permissions.ModifyPortalContent, 'applyDeliverySolver') # security.declareProtected(Permissions.ModifyPortalContent, 'applyDeliverySolver')
# def applyDeliverySolver(self, solver): # def applyDeliverySolver(self, solver):
# self.portal_simulation.applyDeliverySolver(self, solver) # self.portal_simulation.applyDeliverySolver(self, solver)
# #
# security.declareProtected(Permissions.ModifyPortalContent, 'applyTargetSolver') # security.declareProtected(Permissions.ModifyPortalContent, 'applyTargetSolver')
# def applyTargetSolver(self, solver): # def applyTargetSolver(self, solver):
# self.portal_simulation.applyTargetSolver(self, solver) # self.portal_simulation.applyTargetSolver(self, solver)
...@@ -387,155 +389,154 @@ class Movement(XMLObject, Amount): ...@@ -387,155 +389,154 @@ class Movement(XMLObject, Amount):
def isSimulated(self): def isSimulated(self):
return len(self.getDeliveryRelatedValueList()) > 0 or len(self.getOrderRelatedValueList()) > 0 return len(self.getDeliveryRelatedValueList()) > 0 or len(self.getOrderRelatedValueList()) > 0
# New Causality API # New Causality API
security.declareProtected(Permissions.AccessContentsInformation, 'getOrderQuantity') security.declareProtected(Permissions.AccessContentsInformation, 'getOrderQuantity')
def getOrderQuantity(self): def getOrderQuantity(self):
""" """
Returns the quantity of related order(s) Returns the quantity of related order(s)
""" """
return self.getQuantity() return self.getQuantity()
security.declareProtected(Permissions.AccessContentsInformation, 'getDeliveryQuantity') security.declareProtected(Permissions.AccessContentsInformation, 'getDeliveryQuantity')
def getDeliveryQuantity(self): def getDeliveryQuantity(self):
""" """
Returns the quantity of related delivery(s) Returns the quantity of related delivery(s)
""" """
return self.getQuantity() return self.getQuantity()
security.declareProtected(Permissions.AccessContentsInformation, 'getSimulationQuantity') security.declareProtected(Permissions.AccessContentsInformation, 'getSimulationQuantity')
def getSimulationQuantity(self): def getSimulationQuantity(self):
""" """
Returns the sum of quantities in related simulation movements Returns the sum of quantities in related simulation movements
""" """
return self.getQuantity() return self.getQuantity()
security.declareProtected(Permissions.AccessContentsInformation, 'getOrderStartDateList') security.declareProtected(Permissions.AccessContentsInformation, 'getOrderStartDateList')
def getOrderStartDateList(self): def getOrderStartDateList(self):
""" """
Returns the start date of related order(s) Returns the start date of related order(s)
""" """
return [self.getStartDate()] return [self.getStartDate()]
security.declareProtected(Permissions.AccessContentsInformation, 'getDeliveryStartDateList') security.declareProtected(Permissions.AccessContentsInformation, 'getDeliveryStartDateList')
def getDeliveryStartDateList(self): def getDeliveryStartDateList(self):
""" """
Returns the start date of related delivery(s) Returns the start date of related delivery(s)
""" """
return [self.getStartDate()] return [self.getStartDate()]
security.declareProtected(Permissions.AccessContentsInformation, 'getSimulationStartDateList') security.declareProtected(Permissions.AccessContentsInformation, 'getSimulationStartDateList')
def getSimulationStartDateList(self): def getSimulationStartDateList(self):
""" """
Returns the of start date related simulation movements Returns the of start date related simulation movements
""" """
return [self.getStartDate()] return [self.getStartDate()]
security.declareProtected(Permissions.AccessContentsInformation, 'getOrderStopDateList') security.declareProtected(Permissions.AccessContentsInformation, 'getOrderStopDateList')
def getOrderStopDateList(self): def getOrderStopDateList(self):
""" """
Returns the stop date of related order(s) Returns the stop date of related order(s)
""" """
return [self.getStopDate()] return [self.getStopDate()]
security.declareProtected(Permissions.AccessContentsInformation, 'getDeliveryStopDateList') security.declareProtected(Permissions.AccessContentsInformation, 'getDeliveryStopDateList')
def getDeliveryStopDateList(self): def getDeliveryStopDateList(self):
""" """
Returns the stop date of related delivery(s) Returns the stop date of related delivery(s)
""" """
return [self.getStopDate()] return [self.getStopDate()]
security.declareProtected(Permissions.AccessContentsInformation, 'getSimulationStopDateList') security.declareProtected(Permissions.AccessContentsInformation, 'getSimulationStopDateList')
def getSimulationStopDateList(self): def getSimulationStopDateList(self):
""" """
Returns the of stop date related simulation movements Returns the of stop date related simulation movements
""" """
return [self.getStopDate()] return [self.getStopDate()]
security.declareProtected(Permissions.AccessContentsInformation, 'getOrderSourceList') security.declareProtected(Permissions.AccessContentsInformation, 'getOrderSourceList')
def getOrderSourceList(self): def getOrderSourceList(self):
""" """
Returns the source of related orders Returns the source of related orders
""" """
return self.getSourceList() return self.getSourceList()
security.declareProtected(Permissions.AccessContentsInformation, 'getDeliverySourceList') security.declareProtected(Permissions.AccessContentsInformation, 'getDeliverySourceList')
def getDeliverySourceList(self): def getDeliverySourceList(self):
""" """
Returns the source of related deliveries Returns the source of related deliveries
""" """
return self.getSourceList() return self.getSourceList()
security.declareProtected(Permissions.AccessContentsInformation, 'getSimulationSourceList') security.declareProtected(Permissions.AccessContentsInformation, 'getSimulationSourceList')
def getSimulationSourceList(self): def getSimulationSourceList(self):
""" """
Returns the source of related simulation movements Returns the source of related simulation movements
""" """
return self.getSourceList() return self.getSourceList()
security.declareProtected(Permissions.AccessContentsInformation, 'getOrderDestinationList') security.declareProtected(Permissions.AccessContentsInformation, 'getOrderDestinationList')
def getOrderDestinationList(self): def getOrderDestinationList(self):
""" """
Returns the destination of related orders Returns the destination of related orders
""" """
return self.getDestinationList() return self.getDestinationList()
security.declareProtected(Permissions.AccessContentsInformation, 'getDeliveryDestinationList') security.declareProtected(Permissions.AccessContentsInformation, 'getDeliveryDestinationList')
def getDeliveryDestinationList(self): def getDeliveryDestinationList(self):
""" """
Returns the destination of related deliveries Returns the destination of related deliveries
""" """
return self.getDestinationList() return self.getDestinationList()
security.declareProtected(Permissions.AccessContentsInformation, 'getSimulationDestinationList') security.declareProtected(Permissions.AccessContentsInformation, 'getSimulationDestinationList')
def getSimulationDestinationList(self): def getSimulationDestinationList(self):
""" """
Returns the destination of related simulation movements Returns the destination of related simulation movements
""" """
return self.getDestinationList() return self.getDestinationList()
security.declareProtected(Permissions.AccessContentsInformation, 'getOrderSourceSectionList') security.declareProtected(Permissions.AccessContentsInformation, 'getOrderSourceSectionList')
def getOrderSourceSectionList(self): def getOrderSourceSectionList(self):
""" """
Returns the source_section of related orders Returns the source_section of related orders
""" """
return self.getSourceSectionList() return self.getSourceSectionList()
security.declareProtected(Permissions.AccessContentsInformation, 'getDeliverySourceSectionList') security.declareProtected(Permissions.AccessContentsInformation, 'getDeliverySourceSectionList')
def getDeliverySourceSectionList(self): def getDeliverySourceSectionList(self):
""" """
Returns the source_section of related deliveries Returns the source_section of related deliveries
""" """
return self.getSourceSectionList() return self.getSourceSectionList()
security.declareProtected(Permissions.AccessContentsInformation, 'getSimulationSourceSectionList') security.declareProtected(Permissions.AccessContentsInformation, 'getSimulationSourceSectionList')
def getSimulationSourceSectionList(self): def getSimulationSourceSectionList(self):
""" """
Returns the source_section of related simulation movements Returns the source_section of related simulation movements
""" """
return self.getSourceSectionList() return self.getSourceSectionList()
security.declareProtected(Permissions.AccessContentsInformation, 'getOrderDestinationSectionList') security.declareProtected(Permissions.AccessContentsInformation, 'getOrderDestinationSectionList')
def getOrderDestinationSectionList(self): def getOrderDestinationSectionList(self):
""" """
Returns the destination_section of related orders Returns the destination_section of related orders
""" """
return self.getDestinationSectionList() return self.getDestinationSectionList()
security.declareProtected(Permissions.AccessContentsInformation, 'getDeliveryDestinationSectionList') security.declareProtected(Permissions.AccessContentsInformation, 'getDeliveryDestinationSectionList')
def getDeliveryDestinationSectionList(self): def getDeliveryDestinationSectionList(self):
""" """
Returns the destination_section of related deliveries Returns the destination_section of related deliveries
""" """
return self.getDestinationSectionList() return self.getDestinationSectionList()
security.declareProtected(Permissions.AccessContentsInformation, 'getSimulationDestinationSectionList') security.declareProtected(Permissions.AccessContentsInformation, 'getSimulationDestinationSectionList')
def getSimulationDestinationSectionList(self): def getSimulationDestinationSectionList(self):
""" """
Returns the destination_section of related simulation movements Returns the destination_section of related simulation movements
""" """
return self.getDestinationSectionList() return self.getDestinationSectionList()
# Debit and credit methods # Debit and credit methods
security.declareProtected(Permissions.AccessContentsInformation, 'getSourceDebit') security.declareProtected(Permissions.AccessContentsInformation, 'getSourceDebit')
def getSourceDebit(self): def getSourceDebit(self):
...@@ -543,12 +544,10 @@ class Movement(XMLObject, Amount): ...@@ -543,12 +544,10 @@ class Movement(XMLObject, Amount):
Return the quantity Return the quantity
""" """
quantity = self.getQuantity() quantity = self.getQuantity()
try: try:
quantity = float(quantity) quantity = float(quantity)
except: except:
quantity = 0.0 quantity = 0.0
if quantity < 0: if quantity < 0:
return - quantity return - quantity
else: else:
...@@ -560,12 +559,10 @@ class Movement(XMLObject, Amount): ...@@ -560,12 +559,10 @@ class Movement(XMLObject, Amount):
Return the quantity Return the quantity
""" """
quantity = self.getQuantity() quantity = self.getQuantity()
try: try:
quantity = float(quantity) quantity = float(quantity)
except: except:
quantity = 0.0 quantity = 0.0
if quantity < 0: if quantity < 0:
return 0.0 return 0.0
else: else:
...@@ -617,7 +614,6 @@ class Movement(XMLObject, Amount): ...@@ -617,7 +614,6 @@ class Movement(XMLObject, Amount):
""" """
return return
# Item Access (tracking) # Item Access (tracking)
security.declareProtected(Permissions.AccessContentsInformation, 'getTrackedItemUidList') security.declareProtected(Permissions.AccessContentsInformation, 'getTrackedItemUidList')
def getTrackedItemUidList(self): def getTrackedItemUidList(self):
...@@ -627,30 +623,27 @@ class Movement(XMLObject, Amount): ...@@ -627,30 +623,27 @@ class Movement(XMLObject, Amount):
### XXX We should filter by portal type here ### XXX We should filter by portal type here
return self.getAggregateUidList() return self.getAggregateUidList()
# SKU vs. CU # SKU vs. CU
# security.declareProtected(Permissions.AccessContentsInformation, 'getSourceStandardInventoriatedQuantity') # security.declareProtected(Permissions.AccessContentsInformation, 'getSourceStandardInventoriatedQuantity')
# def getSourceStandardInventoriatedQuantity(self): # def getSourceStandardInventoriatedQuantity(self):
# """ # """
# The inventoriated quantity converted in a default unit # The inventoriated quantity converted in a default unit
# #
# For assortments, returns the inventoriated quantity in terms of number of items # For assortments, returns the inventoriated quantity in terms of number of items
# in the assortemnt. # in the assortemnt.
# #
# For accounting, returns the quantity converted in a default unit # For accounting, returns the quantity converted in a default unit
# """ # """
# return self.getStandardInventoriatedQuantity() # return self.getStandardInventoriatedQuantity()
#
# security.declareProtected(Permissions.AccessContentsInformation, 'getDestinationStandardInventoriatedQuantity') # security.declareProtected(Permissions.AccessContentsInformation, 'getDestinationStandardInventoriatedQuantity')
# def getDestinationStandardInventoriatedQuantity(self): # def getDestinationStandardInventoriatedQuantity(self):
# """ # """
# The inventoriated quantity converted in a default unit # The inventoriated quantity converted in a default unit
# #
# For assortments, returns the inventoriated quantity in terms of number of items # For assortments, returns the inventoriated quantity in terms of number of items
# in the assortemnt. # in the assortemnt.
# #
# For accounting, returns the quantity converted in a default unit # For accounting, returns the quantity converted in a default unit
# """ # """
# return self.getStandardInventoriatedQuantity() # return self.getStandardInventoriatedQuantity()
# \ No newline at end of file
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