From 04c14d566596eccb1ad7bfcb03072745eeb7c845 Mon Sep 17 00:00:00 2001 From: Christopher Ormaza Date: Thu, 10 Mar 2022 08:26:20 -0500 Subject: [PATCH] [IMP] rma: add origin_returned_move_id on moves created for pickings after run procurement --- rma/wizards/rma_make_picking.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/rma/wizards/rma_make_picking.py b/rma/wizards/rma_make_picking.py index 3da7a848..291f664f 100644 --- a/rma/wizards/rma_make_picking.py +++ b/rma/wizards/rma_make_picking.py @@ -197,6 +197,17 @@ class RmaMakePicking(models.TransientModel): else: pickings = self.mapped("item_ids.line_id")._get_in_pickings() action = self.item_ids.line_id.action_view_in_shipments() + for move in pickings.move_lines.filtered( + lambda x: x.state not in ("draft", "cancel", "done") + and x.rma_line_id + and x.rma_line_id.reference_move_id + and not x.origin_returned_move_id + and not x.move_orig_ids + ): + move.write( + {"origin_returned_move_id": move.rma_line_id.reference_move_id.id} + ) + if picking_type == "incoming": # Force the reservation of the RMA specific lot for incoming shipments. # FIXME: still needs fixing, not reserving appropriate serials.