details:   https://code.tryton.org/tryton/commit/d71afdf7ea6e
branch:    7.6
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 |  12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diffs (31 lines):

diff -r 5d981bdc9b57 -r d71afdf7ea6e 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
@@ -519,6 +519,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)
@@ -546,10 +551,13 @@
                     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'
 
 

Reply via email to