Lots Management Enhancement

This commit is contained in:
2026-05-09 11:03:51 +02:00
parent c27c915700
commit d8ac25dcda
7 changed files with 291 additions and 102 deletions

View File

@@ -403,11 +403,16 @@ class ShipmentWR(ModelSQL,ModelView):
class ShipmentIn(metaclass=PoolMeta):
__name__ = 'stock.shipment.in'
from_location = fields.Many2One('stock.location', 'From location')
to_location = fields.Many2One('stock.location', 'To location')
transport_type = fields.Selection([
('vessel', 'Vessel'),
('truck', 'Truck'),
from_location = fields.Many2One('stock.location', 'From location')
to_location = fields.Many2One('stock.location', 'To location')
shipment_type = fields.Function(fields.Selection([
(None, ''),
('dropship', 'Dropship'),
('inbound', 'Inbound'),
], "Shipment Type"), 'get_shipment_type')
transport_type = fields.Selection([
('vessel', 'Vessel'),
('truck', 'Truck'),
('other', 'Other'),
], 'Transport type')
vessel = fields.Many2One('trade.vessel',"Vessel")
@@ -477,6 +482,14 @@ class ShipmentIn(metaclass=PoolMeta):
if self.vessel:
return self.vessel.vessel_type
@fields.depends('from_location', 'to_location')
def get_shipment_type(self, name=None):
if (self.from_location and self.to_location
and self.from_location.type == 'supplier'
and self.to_location.type == 'customer'):
return 'dropship'
return 'inbound'
def _get_report_primary_move(self):
moves = list(self.incoming_moves or self.moves or [])
return moves[0] if moves else None