[fix] Get fifo rate only qty exists in batch

This commit is contained in:
Nabin Hait 2015-08-03 11:56:21 +05:30
parent 845bbe3e27
commit 7edb951fdb
2 changed files with 29 additions and 28 deletions

View File

@ -300,7 +300,7 @@ class update_entries_after(object):
# select first batch or the batch with same rate
batch = self.stock_queue[index]
if batch[0]:
if qty_to_pop >= batch[0]:
# consume current batch
qty_to_pop = qty_to_pop - batch[0]

View File

@ -133,6 +133,7 @@ def get_fifo_rate(previous_stock_queue, qty):
qty_to_pop = abs(qty)
while qty_to_pop and previous_stock_queue:
batch = previous_stock_queue[0]
if batch[0]:
if 0 < batch[0] <= qty_to_pop:
# if batch qty > 0
# not enough or exactly same qty in current batch, clear batch