Commit b71cc88b authored by Kevin Deldycke's avatar Kevin Deldycke

Make getTotalPrice working on Delivery Cells


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4011 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d6d633e4
......@@ -29,16 +29,18 @@
from Globals import InitializeClass
from AccessControl import ClassSecurityInfo
from Products.ERP5.Variated import Variated
from Products.ERP5.VariationValue import VariationValue
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5Type.Base import Base
from Products.ERP5.VariationValue import VariationValue
from Products.ERP5.Variated import Variated
from Products.ERP5Type.Base import TempBase
from Products.CMFCategory.Renderer import Renderer
from zLOG import LOG
class Amount(Base, Variated):
"""
A mix-in class which provides some utilities
......@@ -313,7 +315,6 @@ class Amount(Base, Variated):
unit_base_price = resource.getPrice(context=self)
return unit_base_price
security.declareProtected(Permissions.AccessContentsInformation, 'getDuration')
def getDuration(self):
"""
......@@ -323,14 +324,11 @@ class Amount(Base, Variated):
quantity_unit = self.getQuantityUnit()
if quantity_unit is None:
return None
common_time_category = 'time'
if common_time_category in quantity_unit[:len(common_time_category)]:
duration = quantity
else:
duration = None
return duration
security.declareProtected(Permissions.AccessContentsInformation, 'getTotalBasePrice')
......@@ -342,13 +340,14 @@ class Amount(Base, Variated):
efficiency = self.getEfficiency()
if efficiency != 0:
resource_price = self.getResourcePrice()
if resource_price is None:
return None
result = resource_price * self.getConvertedQuantity() / efficiency
if resource_price is not None:
return resource_price * self.getConvertedQuantity() / efficiency
price = self.getPrice()
quantity = self.getQuantity()
if type(price) in (type(1.0), type(1)) and type(quantity) in (type(1.0), type(1)):
result = quantity * price
return result
# Conversion to standard unit
security.declareProtected(Permissions.AccessContentsInformation, 'getConvertedQuantity')
def getConvertedQuantity(self):
......@@ -586,4 +585,3 @@ class Amount(Base, Variated):
def _setLostQuantity(self, value):
return self._setProfitQuantity(- value)
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