Commit ee49ff32 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin Committed by Cédric Le Ninivin

builder mixin: take into account supply start date even if it is defined on line

parent f1b249a5
......@@ -431,6 +431,12 @@ class BuilderMixin(XMLObject, Amount, Predicate):
for brain in previous_movement_list:
brain.getObject().setQuantity(0)
# Calculate first possible shipment:
first_shipment_date = max(
supply.getStartDateRangeMin(),
supply.getParentValue().getStartDateRangeMin()
)
# Prepare history list to work with
history_list = resource_value.Resource_getInventoryHistoryList(
from_date=from_date,
......@@ -535,7 +541,7 @@ class BuilderMixin(XMLObject, Amount, Predicate):
# XXX CLN This is very naive, it has to be optimized
if start_date > supply.getStartDateRangeMax():
break
if start_date < supply.getStartDateRangeMin():
if start_date < first_shipment_date:
# As we are going to need to go further in time to check if new Movements are needed
# we need to keep inventory correct
#future_inventory_to_date += quantity
......
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