Commit af64e340 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

builder: Supply builder do not create movement for resources that won't be consumed in the future

parent 71773321
......@@ -425,6 +425,17 @@ class BuilderMixin(XMLObject, Amount, Predicate):
)
#self.log("history_list len: %s" % len(history_list))
# We only consider resources that have consumption movements in
# the future, for those who don't we do not build anything.
has_consumption_movement = False
for date, inventory, quantity, portal_type in history_list:
if quantity < 0:
has_consumption_movement = True
break
if not has_consumption_movement:
return []
# evaluate future inventory at date
future_inventory_to_date = portal.portal_simulation.getFutureInventory(
to_date=from_date,
......
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