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,15 +395,18 @@ class BuilderMixin(XMLObject, Amount, Predicate):
if ordered_inventory + inventory < min_inventory: # SKU
quantity = min_inventory - inventory - ordered_inventory
ordered_quantity, ordered_unit, ordered_date, delivery_date, quantity = minimalQuantity(quantity, date)
ordered_inventory = ordered_inventory + quantity
movement_list.append(
newMovement(
ordered_date,
delivery_date,
ordered_quantity,
ordered_unit
# 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
movement_list.append(
newMovement(
ordered_date,
delivery_date,
ordered_quantity,
ordered_unit
)
)
)
return movement_list
def _searchMovementList(self, **kw):
......
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