Commit 7563bc52 authored by Romain Courteaud's avatar Romain Courteaud

Bug fix: check if quantity/price is None.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4588 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d7051905
...@@ -709,7 +709,9 @@ class FakeMovement: ...@@ -709,7 +709,9 @@ class FakeMovement:
""" """
total_quantity = 0 total_quantity = 0
for movement in self.getMovementList(): for movement in self.getMovementList():
total_quantity += movement.getQuantity() quantity = movement.getQuantity()
if quantity != None:
total_quantity += quantity
return total_quantity return total_quantity
def getAddPrice(self): def getAddPrice(self):
...@@ -718,7 +720,10 @@ class FakeMovement: ...@@ -718,7 +720,10 @@ class FakeMovement:
""" """
total_price = 0 total_price = 0
for movement in self.getMovementList(): for movement in self.getMovementList():
total_price += (movement.getQuantity() * movement.getPrice()) quantity = movement.getQuantity()
price = movement.getPrice()
if (quantity is not None) and (price is not None):
total_price += (quantity * price)
return total_price return total_price
def recursiveReindexObject(self): def recursiveReindexObject(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