Maintain the original reference when splitting shipments and productions

Closes #14190
This commit is contained in:
Cédric Krier
2025-12-29 15:58:40 +01:00
parent aa4d7d2c12
commit b75a14ea86
2 changed files with 7 additions and 1 deletions
+1
View File
@@ -55,6 +55,7 @@ class Production(metaclass=PoolMeta):
count -= 1
if n_productions:
productions.extend(self.copy([self] * n_productions, {
'reference': lambda data: data['reference'],
'quantity': quantity,
'unit': unit.id,
'inputs': None,
+6 -1
View File
@@ -230,7 +230,12 @@ class SplitShipment(Wizard):
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'