Skip to content

Commit

Permalink
fix: maintain FIFO queue even if outgoing_rate is not found (#30563)
Browse files Browse the repository at this point in the history
port of #30560
  • Loading branch information
ankush authored Apr 4, 2022
1 parent d032a0c commit 4cc2383
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions erpnext/stock/stock_ledger.py
Original file line number Diff line number Diff line change
Expand Up @@ -866,16 +866,9 @@ def get_fifo_values(self, sle):
index = i
break

# If no entry found with outgoing rate, collapse stack
# If no entry found with outgoing rate, consume as per FIFO
if index is None: # nosemgrep
new_stock_value = (
sum((d[0] * d[1] for d in self.wh_data.stock_queue)) - qty_to_pop * outgoing_rate
)
new_stock_qty = sum((d[0] for d in self.wh_data.stock_queue)) - qty_to_pop
self.wh_data.stock_queue = [
[new_stock_qty, new_stock_value / new_stock_qty if new_stock_qty > 0 else outgoing_rate]
]
break
index = 0
else:
index = 0

Expand Down

0 comments on commit 4cc2383

Please sign in to comment.