Commit 86d2ee9a authored by Yusei Tahara's avatar Yusei Tahara

Retrieve start_date and stop_date from movement and stop expanding

when reaching to the end date.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35696 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b0cc66cc
......@@ -70,14 +70,22 @@ class OpenOrderRule(DeliveryRule):
order_movement_list = order.getMovementList(
portal_type=order.getPortalOrderMovementTypeList())
now = DateTime()
for order_movement in order_movement_list:
end_date = order_movement.getStopDate() - order.getForecastingTermDayCount()
if end_date > now:
calculation_base_date = now
else:
calculation_base_date = end_date
last_simulation_movement = self._getLastSimulationMovementValue(applied_rule, order_movement)
if last_simulation_movement is not None:
schedule_start_date = last_simulation_movement.getStartDate()
schedule_list = self._getOrderDateScheduleTupleList(order_movement, schedule_start_date, **kw)
schedule_list = self._getOrderDateScheduleTupleList(order_movement, schedule_start_date,
calculation_base_date=calculation_base_date,
**kw)
else:
# Because order's start_date might be matched with the periodicity.
order_start_date = order.getStartDate()
order_start_date = order_movement.getStartDate()
schedule_start_date = order_start_date-1
schedule_list = [date_pair
for date_pair in self._getOrderDateScheduleTupleList(order_movement, schedule_start_date, **kw)
......
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