Add physical lot + Link

This commit is contained in:
2026-06-22 16:14:05 +02:00
parent 95dba725a8
commit 6af3de0ffb
3 changed files with 11 additions and 8 deletions

View File

@@ -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')),

View File

@@ -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)

View File

@@ -16,6 +16,10 @@
<group id="physical_lot_transport" string="Transport"
colspan="12" col="1" panel="card" icon="tryton-link"
xalign="0" yalign="0" col_widths="1fr">
<label name="transport_missing"
string="No shipment is linked to this quantity line. Select an existing Shipment In or create a new one before adding physical lots."
colspan="1" xalign="0" yalign="0" xexpand="1"/>
<group id="physical_lot_transport_choice" colspan="1" col="4"
xalign="0" yalign="0"
col_widths="min-content,1fr,min-content,180px">