Link to transport

This commit is contained in:
2026-06-07 07:30:42 +02:00
parent b3b7803313
commit 1339f9b2f1
2 changed files with 5 additions and 3 deletions

View File

@@ -2972,6 +2972,8 @@ class LotShipping(Wizard):
def default_ship(self, fields):
values = {}
if getattr(self, '_created_shipment_in', None):
values['shipment_in'] = self._created_shipment_in
if len(self.records) != 1:
return values
record = self.records[0]
@@ -3017,7 +3019,7 @@ class LotShipping(Wizard):
if self.ship.shipment_in:
return 'ship'
shipment, = ShipmentIn.create([self._shipment_in_create_values()])
self.ship.shipment_in = shipment
self._created_shipment_in = shipment.id
return 'ship'
def transition_shipping(self):

View File

@@ -223,7 +223,7 @@ class PurchaseTradeTestCase(ModuleTestCase):
'link to transport creates shipment in from planned locations'
wizard = lot_module.LotShipping()
supplier = Mock(id=30)
created_shipment = Mock()
created_shipment = Mock(id=40)
ShipmentIn = Mock()
ShipmentIn.create.return_value = [created_shipment]
wizard.records = [Mock(r_supplier=supplier)]
@@ -244,7 +244,7 @@ class PurchaseTradeTestCase(ModuleTestCase):
'from_location': 10,
'to_location': 20,
}])
self.assertEqual(wizard.ship.shipment_in, created_shipment)
self.assertEqual(wizard.default_ship(None)['shipment_in'], 40)
@with_transaction()
def test_get_mtm_applies_component_ratio_as_percentage(self):