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): ...@@ -395,15 +395,18 @@ 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)
ordered_inventory = ordered_inventory + quantity # XXX CLN This is very naive, it has to be optimized
movement_list.append( if ordered_date <= supply.getStartDateRangeMax()\
newMovement( and ordered_date >= supply.getStartDateRangeMin():
ordered_date, ordered_inventory = ordered_inventory + quantity
delivery_date, movement_list.append(
ordered_quantity, newMovement(
ordered_unit ordered_date,
delivery_date,
ordered_quantity,
ordered_unit
)
) )
)
return movement_list return movement_list
def _searchMovementList(self, **kw): 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