details:   https://code.tryton.org/tryton/commit/df57f2c9c4d6
branch:    7.8
user:      Cédric Krier <[email protected]>
date:      Mon Dec 29 15:58:40 2025 +0100
description:
        Maintain the original reference when splitting shipments and productions

        Closes #14190
        (grafted from b1d2fd68d7e2b865675d7d466e8874247c76c786)
diffstat:

 modules/production_split/production.py |  1 +
 modules/stock_split/stock.py           |  7 ++++++-
 2 files changed, 7 insertions(+), 1 deletions(-)

diffs (28 lines):

diff -r f98c416aca68 -r df57f2c9c4d6 modules/production_split/production.py
--- a/modules/production_split/production.py    Mon Dec 29 17:28:36 2025 +0100
+++ b/modules/production_split/production.py    Mon Dec 29 15:58:40 2025 +0100
@@ -55,6 +55,7 @@
                 count -= 1
         if n_productions:
             productions.extend(self.copy([self] * n_productions, {
+                        'reference': lambda data: data['reference'],
                         'quantity': quantity,
                         'unit': unit.id,
                         'inputs': None,
diff -r f98c416aca68 -r df57f2c9c4d6 modules/stock_split/stock.py
--- a/modules/stock_split/stock.py      Mon Dec 29 17:28:36 2025 +0100
+++ b/modules/stock_split/stock.py      Mon Dec 29 15:58:40 2025 +0100
@@ -230,7 +230,12 @@
             Move.delete(
                 [m for m in shipment.inventory_moves if m.state == 'draft'])
 
-        shipment, = Shipment.copy([shipment], default={'moves': None})
+        shipment, = Shipment.copy(
+            [shipment],
+            default={
+                'reference': lambda data: data['reference'],
+                'moves': None,
+                })
         Move.write(list(self.start.moves), {'shipment': str(shipment)})
         return 'end'
 

Reply via email to