Skip to content

Commit

Permalink
[17.0][UPD] osi_fifo_serialized_fix: fix issue where positive value i…
Browse files Browse the repository at this point in the history
…s added on out transfer instead of subtracted
  • Loading branch information
cbeddies committed May 20, 2024
1 parent 88d1775 commit 5775c95
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions osi_fifo_serialized_fix/models/stock_valuation_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ def create(self, vals_list):
svl_id = self.env["stock.valuation.layer"].browse(val.get("stock_valuation_layer_id"))
if stock_move_id:
if len(stock_move_id.move_line_ids) > 1:
sign = 1 if val["quantity"] >= 0 else -1
for line in stock_move_id.move_line_ids:
new_val = val.copy()
new_val["quantity"] = line.quantity
new_val["remaining_qty"] = line.quantity
new_val["value"] = line.quantity * new_val.get("unit_cost")
new_val["quantity"] = line.quantity * sign
new_val["remaining_qty"] = line.quantity * sign
new_val["value"] = (line.quantity * new_val.get("unit_cost")) * sign
new_val["remaining_value"] = new_val["value"]
if line.lot_id:
new_val["lot_ids"] = [line.lot_id.id]
Expand Down

0 comments on commit 5775c95

Please sign in to comment.