[IMP] rma: add origin_returned_move_id on moves created for pickings after run procurement

This commit is contained in:
Christopher Ormaza
2022-03-10 08:26:20 -05:00
parent d97dbaf9b5
commit 04c14d5665

View File

@@ -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.