Commit 08c19e2f authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

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

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