diff --git a/modules/purchase_trade/lot.py b/modules/purchase_trade/lot.py index 939dc14..6cd673f 100755 --- a/modules/purchase_trade/lot.py +++ b/modules/purchase_trade/lot.py @@ -4329,10 +4329,7 @@ class LotAdding(Wizard): 'shipment_internal':sh_int, 'shipment_out':sh_out, 'transport_missing': not any((sh_in, sh_int, sh_out)), - 'shipment_supplier': ( - purchase.party.id - if not any((sh_in, sh_int, sh_out)) and purchase.party - else None), + 'shipment_supplier': None, 'transport_from_location': ( (lqt.planned_from_location or purchase.from_location).id if not any((sh_in, sh_int, sh_out)) @@ -4357,7 +4354,7 @@ class LotAdding(Wizard): "shipment.") if self.add.create_new_shipment: if not self.add.shipment_supplier: - raise UserError("Shipment supplier is required.") + raise UserError("Shipment broker is required.") ShipmentIn = Pool().get('stock.shipment.in') values = { 'supplier': self.add.shipment_supplier.id, @@ -4393,12 +4390,14 @@ class LotAddLot(ModelView): unit = fields.Many2One('product.uom',"Unit",readonly=True) quantity = fields.Numeric("Quantity available",digits='unit',readonly=True) unlink_remainder = fields.Boolean("Unlink remaining quantity") - transport_missing = fields.Boolean("Transport missing", readonly=True) + transport_missing = fields.Boolean( + "Transport missing", readonly=True, + states={'invisible': ~Eval('transport_missing')}) create_new_shipment = fields.Boolean( "Create a new shipment", states={'invisible': ~Eval('transport_missing')}) shipment_supplier = fields.Many2One( - 'party.party', "Shipment supplier", + 'party.party', "Broker", states={ 'invisible': ~( Eval('transport_missing') & Eval('create_new_shipment')), diff --git a/modules/purchase_trade/tests/test_module.py b/modules/purchase_trade/tests/test_module.py index 11e7a65..4b34f66 100644 --- a/modules/purchase_trade/tests/test_module.py +++ b/modules/purchase_trade/tests/test_module.py @@ -783,7 +783,7 @@ class PurchaseTradeTestCase(ModuleTestCase): values = wizard.default_add(None) self.assertTrue(values['transport_missing']) - self.assertEqual(values['shipment_supplier'], 30) + self.assertIsNone(values['shipment_supplier']) self.assertEqual(values['transport_from_location'], 10) self.assertEqual(values['transport_to_location'], 20) diff --git a/modules/purchase_trade/view/lot_add_start_form.xml b/modules/purchase_trade/view/lot_add_start_form.xml index 2eb5adf..3bce898 100755 --- a/modules/purchase_trade/view/lot_add_start_form.xml +++ b/modules/purchase_trade/view/lot_add_start_form.xml @@ -16,6 +16,10 @@ +