From 56ec009f0bb42734f8000be2b25a061f72f4ed62 Mon Sep 17 00:00:00 2001 From: Sergi Almacellas Abellana Date: Thu, 23 Apr 2026 13:36:23 +0200 Subject: [PATCH] Manage assigned moves on add lots wizard Closes #14804 (grafted from 83ef4c017af5df55178fa22f7775d35fd7f28874) --HG-- branch : 8.0 --- modules/stock_lot/stock.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/modules/stock_lot/stock.py b/modules/stock_lot/stock.py index f5f2b0268f..f981718422 100644 --- a/modules/stock_lot/stock.py +++ b/modules/stock_lot/stock.py @@ -522,6 +522,11 @@ class MoveAddLots(Wizard): 'stock_lot.msg_move_add_lot_quantity', lot_quantity=lang.format_number(lot_quantity, digits), move_quantity=lang.format_number(move_quantity, digits))) + moves = [self.record] + state = self.record.state + self.model.write(moves, { + 'state': 'draft', + }) lots = [] for line in self.start.lots: lot = line.get_lot(self.record) @@ -549,10 +554,13 @@ class MoveAddLots(Wizard): self.record.save() else: with Transaction().set_context(_stock_move_split=True): - self.model.copy([self.record], { + moves.extend(self.model.copy([self.record], { 'quantity': line.quantity, 'lot': lot.id, - }) + })) + self.model.write(moves, { + 'state': state, + }) return 'end'