Skip to content

Commit

Permalink
[FIX] rma_sale_lot: force ml reservation to the restricted lot
Browse files Browse the repository at this point in the history
  • Loading branch information
sbejaoui committed Feb 18, 2025
1 parent b62361e commit a90dc64
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions rma_sale_lot/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
from . import sale_order_line
from . import sale_order
from . import rma
16 changes: 16 additions & 0 deletions rma_sale_lot/models/rma.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2025 ACSONE SA/NV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import models


class Rma(models.Model):

_inherit = "rma"

def action_confirm(self):
res = super().action_confirm()
restricted_moves = self.reception_move_id.filtered("restrict_lot_id")
for ml in restricted_moves.move_line_ids:
ml.lot_id = ml.move_id.restrict_lot_id
return res
2 changes: 2 additions & 0 deletions rma_sale_lot/tests/test_rma_sale_lot.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ def test_partial_return(self):
self.assertEqual(rma_1.reception_move_id.restrict_lot_id, self.lot_1)
self.assertEqual(rma_2.reception_move_id.restrict_lot_id, self.lot_2)
self.assertEqual(rma_2.product_uom_qty, 1)
self.assertEqual(rma_1.reception_move_id.move_line_ids.lot_id, self.lot_1)
self.assertEqual(rma_2.reception_move_id.move_line_ids.lot_id, self.lot_2)

def test_full_return_after_partial_return(self):
self.test_partial_return()
Expand Down

0 comments on commit a90dc64

Please sign in to comment.