Commit 0df6199d authored by Tatuya Kamada's avatar Tatuya Kamada

Check that the movement whether to have the getMappedProperty method or not, before calling it.

Because not all the movement have the method.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@38661 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2848218b
......@@ -412,7 +412,10 @@ class FakeMovement:
"""
total_quantity = 0
for movement in self.getMovementList():
quantity = movement.getMappedProperty('quantity')
if getattr(movement, 'getMappedProperty', None) is not None:
quantity = movement.getMappedProperty('quantity')
else:
quantity = movement.getQuantity()
if quantity != None:
total_quantity += quantity
return total_quantity
......@@ -423,7 +426,10 @@ class FakeMovement:
"""
total_price = 0
for movement in self.getMovementList():
quantity = movement.getMappedProperty('quantity')
if getattr(movement, 'getMappedProperty', None) is not None:
quantity = movement.getMappedProperty('quantity')
else:
quantity = movement.getQuantity()
price = movement.getPrice()
if (quantity is not None) and (price is not None):
total_price += (quantity * price)
......
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