Commit 6e6f19f5 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

builder mixin: Take into account supply date range before create movement

parent 0ccbea5d
...@@ -395,6 +395,9 @@ class BuilderMixin(XMLObject, Amount, Predicate): ...@@ -395,6 +395,9 @@ class BuilderMixin(XMLObject, Amount, Predicate):
if ordered_inventory + inventory < min_inventory: # SKU if ordered_inventory + inventory < min_inventory: # SKU
quantity = min_inventory - inventory - ordered_inventory quantity = min_inventory - inventory - ordered_inventory
ordered_quantity, ordered_unit, ordered_date, delivery_date, quantity = minimalQuantity(quantity, date) ordered_quantity, ordered_unit, ordered_date, delivery_date, quantity = minimalQuantity(quantity, date)
# XXX CLN This is very naive, it has to be optimized
if ordered_date <= supply.getStartDateRangeMax()\
and ordered_date >= supply.getStartDateRangeMin():
ordered_inventory = ordered_inventory + quantity ordered_inventory = ordered_inventory + quantity
movement_list.append( movement_list.append(
newMovement( newMovement(
......
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