Commit 85808303 authored by Guillaume Michon's avatar Guillaume Michon

getDuration() returns None if quantity_unit is None

getTotalPrice() returns None if getResourcePrice() returns None


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3476 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9335e811
......@@ -267,6 +267,8 @@ class Amount(Base, Variated):
"""
quantity = self.getQuantity()
quantity_unit = self.getQuantityUnit()
if quantity_unit is None:
return None
common_time_category = 'time'
......@@ -285,7 +287,10 @@ class Amount(Base, Variated):
result = None
efficiency = self.getEfficiency()
if efficiency != 0:
result = self.getResourcePrice() * self.getConvertedQuantity() / efficiency
resource_price = self.getResourcePrice()
if resource_price is None:
return None
result = resource_price * self.getConvertedQuantity() / efficiency
return result
......
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