Commit c06ff199 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

* use converted_quantity instead of quantity to support quantity unit when aggregating quantity.

* rename variables to make more sense.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31483 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c31c2d0c
...@@ -96,21 +96,22 @@ class MovementCollectionUpdaterMixin: ...@@ -96,21 +96,22 @@ class MovementCollectionUpdaterMixin:
tester_key.append(None) tester_key.append(None)
tester_key = tuple(tester_key) tester_key = tuple(tester_key)
# try to aggregate # try to aggregate
group_list = prevision_movement_dict.setdefault(tester_key, []) aggregated_movement_list = prevision_movement_dict.setdefault(tester_key,
[])
no_match = True no_match = True
for group_movement in group_list: for aggregated_movement in aggregated_movement_list:
if _compare(tester_list, group_movement, movement): if _compare(tester_list, aggregated_movement, movement):
no_match = False no_match = False
order = movement.getOrder() order = movement.getOrder()
if order is not None: if order is not None:
group_movement.setOrderList( aggregated_movement.setOrderList(
group_movement.getOrderList() + [order]) aggregated_movement.getOrderList() + [order])
# XXX how to handle quantity unit conversion here? aggregated_movement.setConvertedQuantity(
group_movement.setQuantity( aggregated_movement.getConvertedQuantity() + \
group_movement.getQuantity() + movement.getQuantity()) movement.getConvertedQuantity())
if no_match: if no_match:
group_list.append(movement) aggregated_movement_list.append(movement)
prevision_movement_dict[tester_key] = group_list prevision_movement_dict[tester_key] = aggregated_movement_list
# Prepare a mapping between prevision and decision # Prepare a mapping between prevision and decision
# The prevision_to_decision_map is a list of tuples # The prevision_to_decision_map is a list of tuples
......
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