details:   https://code.tryton.org/tryton/commit/b168e58e64ea
branch:    7.0
user:      Sergi Almacellas Abellana <[email protected]>
date:      Thu Apr 23 13:36:23 2026 +0200
description:
        Manage assigned moves on add lots wizard

        Closes #14804
        (grafted from 83ef4c017af5df55178fa22f7775d35fd7f28874)
diffstat:

 modules/stock_lot/stock.py |  16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diffs (33 lines):

diff -r 965645d85f03 -r b168e58e64ea modules/stock_lot/stock.py
--- a/modules/stock_lot/stock.py        Fri Apr 24 11:45:37 2026 +0200
+++ b/modules/stock_lot/stock.py        Thu Apr 23 13:36:23 2026 +0200
@@ -515,6 +515,11 @@
                     '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)
@@ -530,10 +535,13 @@
                 self.record.save()
             else:
                 with Transaction().set_context(_stock_move_split=True):
-                    self.model.copy([self.record], {
-                            'quantity': line.quantity,
-                            'lot': lot.id,
-                            })
+                    moves.extend(self.model.copy([self.record], {
+                                'quantity': line.quantity,
+                                'lot': lot.id,
+                                }))
+        self.model.write(moves, {
+                'state': state,
+                })
         return 'end'
 
 

Reply via email to