Add physical lot + Link
This commit is contained in:
@@ -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')),
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user