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
No related merge requests found
......@@ -96,21 +96,22 @@ class MovementCollectionUpdaterMixin:
tester_key.append(None)
tester_key = tuple(tester_key)
# try to aggregate
group_list = prevision_movement_dict.setdefault(tester_key, [])
aggregated_movement_list = prevision_movement_dict.setdefault(tester_key,
[])
no_match = True
for group_movement in group_list:
if _compare(tester_list, group_movement, movement):
for aggregated_movement in aggregated_movement_list:
if _compare(tester_list, aggregated_movement, movement):
no_match = False
order = movement.getOrder()
if order is not None:
group_movement.setOrderList(
group_movement.getOrderList() + [order])
# XXX how to handle quantity unit conversion here?
group_movement.setQuantity(
group_movement.getQuantity() + movement.getQuantity())
aggregated_movement.setOrderList(
aggregated_movement.getOrderList() + [order])
aggregated_movement.setConvertedQuantity(
aggregated_movement.getConvertedQuantity() + \
movement.getConvertedQuantity())
if no_match:
group_list.append(movement)
prevision_movement_dict[tester_key] = group_list
aggregated_movement_list.append(movement)
prevision_movement_dict[tester_key] = aggregated_movement_list
# Prepare a mapping between prevision and decision
# 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