Skip to content

Commit

Permalink
[FIX] stock_valuation_fifo_lot
Browse files Browse the repository at this point in the history
This commit fixes the incorrect stock_valuation_layer values for deliveries when the product was received before this module was installed.
The issue occurs because the old stock_valuation_layer records do not have lot_ids values, which leads to incorrect valuation during the delivery process.
Issue link: #1350 (comment)
  • Loading branch information
AungKoKoLin1997 committed Aug 22, 2024
1 parent 0197b24 commit 07a5f63
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion stock_valuation_fifo_lot/models/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@ def _run_fifo(self, quantity, company):
qty_to_take_on_candidates = move_line.product_uom_id._compute_quantity(
move_line.qty_done, move.product_id.uom_id
)
# Find incoming stock valuation layers that have lot_ids on their moves
# Check with stock_move_id.lot_ids to cover the situation where the stock
# was received either before or after the installation of this module
candidates = self._get_fifo_candidates(company).filtered(
lambda l: move_line.lot_id in l.lot_ids
lambda l: move_line.lot_id in l.stock_move_id.lot_ids
)
for candidate in candidates:
qty_taken_on_candidate = min(
Expand Down

0 comments on commit 07a5f63

Please sign in to comment.