Commit 6e869e1b authored by Yoshinori Okuji's avatar Yoshinori Okuji

If calculation_base_date is passed explicitly, use that instead of calculating internally.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@39277 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent bd25a35d
......@@ -49,7 +49,7 @@ class OpenOrderRule(DeliveryRule):
# Simulation workflow
security.declareProtected(Permissions.ModifyPortalContent, 'expand')
def expand(self, applied_rule, force=0, **kw):
def expand(self, applied_rule, force=0, calculation_base_date=None, **kw):
"""
Expands the Order to a new simulation tree.
expand is only allowed to modify a simulation movement if it doesn't
......@@ -71,12 +71,16 @@ class OpenOrderRule(DeliveryRule):
portal_type=order.getPortalOrderMovementTypeList())
now = DateTime()
passed_calculation_base_date = calculation_base_date
for order_movement in order_movement_list:
if passed_calculation_base_date is None:
end_date = order_movement.getStopDate() - order.getForecastingTermDayCount()
if end_date > now:
calculation_base_date = now
else:
calculation_base_date = end_date
else:
calculation_base_date = passed_calculation_base_date
last_simulation_movement = self._getLastSimulationMovementValue(applied_rule, order_movement)
if last_simulation_movement is not None:
schedule_start_date = last_simulation_movement.getStartDate()
......
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