Commit fea98212 authored by Sebastien Robin's avatar Sebastien Robin

builder: stock optimisation, not all resource might need to be optimized

before, the code was going through an error when no date was found for
doing stock optimisation. But we do date is found, this only means that
the stock is not going below the expected value, so we do not need to do
any optimisation
parent 6919ce97
...@@ -228,17 +228,17 @@ class BuilderMixin(XMLObject, Amount, Predicate): ...@@ -228,17 +228,17 @@ class BuilderMixin(XMLObject, Amount, Predicate):
variation_text=movement.getVariationText(), variation_text=movement.getVariationText(),
from_date=DateTime(), from_date=DateTime(),
**kw) **kw)
assert stop_date is not None if stop_date != None:
max_delay = resource.getMaxDelay(0) max_delay = resource.getMaxDelay(0)
movement.edit( movement.edit(
start_date=DateTime(((stop_date-max_delay).Date())), start_date=DateTime(((stop_date-max_delay).Date())),
stop_date=DateTime(stop_date.Date()), stop_date=DateTime(stop_date.Date()),
quantity=max(min_flow, -inventory_item.inventory), quantity=max(min_flow, -inventory_item.inventory),
quantity_unit=resource.getQuantityUnit() quantity_unit=resource.getQuantityUnit()
# XXX FIXME define on a supply line # XXX FIXME define on a supply line
# quantity_unit # quantity_unit
) )
movement_list.append(movement) movement_list.append(movement)
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