Skip to content

Commit 07a5f63

Browse files
[FIX] stock_valuation_fifo_lot
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)
1 parent 0197b24 commit 07a5f63

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

stock_valuation_fifo_lot/models/product.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,11 @@ def _run_fifo(self, quantity, company):
4444
qty_to_take_on_candidates = move_line.product_uom_id._compute_quantity(
4545
move_line.qty_done, move.product_id.uom_id
4646
)
47+
# Find incoming stock valuation layers that have lot_ids on their moves
48+
# Check with stock_move_id.lot_ids to cover the situation where the stock
49+
# was received either before or after the installation of this module
4750
candidates = self._get_fifo_candidates(company).filtered(
48-
lambda l: move_line.lot_id in l.lot_ids
51+
lambda l: move_line.lot_id in l.stock_move_id.lot_ids
4952
)
5053
for candidate in candidates:
5154
qty_taken_on_candidate = min(

0 commit comments

Comments
 (0)