Commit a0826e3f authored by Łukasz Nowak's avatar Łukasz Nowak

- simplify and document decisions for applying and checking if something new was created


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27607 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e4823099
...@@ -192,15 +192,16 @@ class TradeModelLine(Predicate, XMLMatrix, Amount): ...@@ -192,15 +192,16 @@ class TradeModelLine(Predicate, XMLMatrix, Amount):
# have to look on cells, if we don't, look on self) # have to look on cells, if we don't, look on self)
for movement in movement_list: for movement in movement_list:
if set(base_application_list)\ if set(base_application_list)\
.intersection(set(movement.getBaseContributionList())): .intersection(set(movement.getBaseContributionList())) and \
if len(movement.getVariationCategoryList()) == 0 or \ len(movement.getVariationCategoryList()) == 0 or \
set(movement.getVariationCategoryList()).intersection(\ set(movement.getVariationCategoryList()).intersection( \
set(tmp_movement.getVariationCategoryList())): set(tmp_movement.getVariationCategoryList())):
# if the movement have no variation category, it's the same as # at least one base application is in base contributions and
# if he have all variation categories # if the movement have no variation category, it's the same as
quantity = tmp_movement.getQuantity(0.0) # if he have all variation categories
modified = 1 quantity = tmp_movement.getQuantity(0.0)
tmp_movement.setQuantity(quantity + movement.getTotalPrice()) modified = 1
tmp_movement.setQuantity(quantity + movement.getTotalPrice())
else: else:
# if the quantity is defined, we use it # if the quantity is defined, we use it
modified = 1 modified = 1
...@@ -228,8 +229,8 @@ class TradeModelLine(Predicate, XMLMatrix, Amount): ...@@ -228,8 +229,8 @@ class TradeModelLine(Predicate, XMLMatrix, Amount):
elif model_slice_max: elif model_slice_max:
tmp_movement.setQuantity(model_slice_max-model_slice_min) tmp_movement.setQuantity(model_slice_max-model_slice_min)
if not update: if not update and modified:
if modified: # no movements were updated, but something was modified, so new movement appeared
aggregated_amount_list.append(tmp_movement) aggregated_amount_list.append(tmp_movement)
return aggregated_amount_list return aggregated_amount_list
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