Commit ab819d82 authored by Sebastien Robin's avatar Sebastien Robin

added cancellation amount property and use it for getSource/Destination Credit/Debit

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15861 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b564eb25
...@@ -734,7 +734,9 @@ class Movement(XMLObject, Amount): ...@@ -734,7 +734,9 @@ class Movement(XMLObject, Amount):
quantity = float(quantity) quantity = float(quantity)
except TypeError: except TypeError:
quantity = 0.0 quantity = 0.0
if quantity < 0: if (quantity < 0 and not self.isCancellationAmount()):
return - quantity
elif quantity > 0 and self.isCancellationAmount():
return - quantity return - quantity
else: else:
return 0.0 return 0.0
...@@ -750,7 +752,8 @@ class Movement(XMLObject, Amount): ...@@ -750,7 +752,8 @@ class Movement(XMLObject, Amount):
quantity = float(quantity) quantity = float(quantity)
except TypeError: except TypeError:
quantity = 0.0 quantity = 0.0
if quantity < 0: if quantity < 0 and not self.isCancellationAmount() \
or quantity > 0 and self.isCancellationAmount():
return 0.0 return 0.0
else: else:
return quantity return quantity
......
...@@ -91,6 +91,10 @@ class Amount: ...@@ -91,6 +91,10 @@ class Amount:
'acquisition_accessor_id' : 'getQuantity', 'acquisition_accessor_id' : 'getQuantity',
'acquisition_depends' : None, 'acquisition_depends' : None,
'mode' : 'w' }, 'mode' : 'w' },
{ 'id' : 'cancellation_amount',
'description' : 'defines if this quantity is used in order to cancel another one',
'type' : 'boolean',
'mode' : 'w' },
# quantity_sign is used by QuantitySignMovementGroup # quantity_sign is used by QuantitySignMovementGroup
# When comparing a delivery to a property_dict coming from a MovementGroup, # When comparing a delivery to a property_dict coming from a MovementGroup,
# the DeliveryBuilder needs to have at least a specific property for each MovementGroup # the DeliveryBuilder needs to have at least a specific property for each MovementGroup
......
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