This commit is contained in:
2026-06-12 20:34:47 +02:00
parent 7107625664
commit 1a5e2e4033
6 changed files with 205 additions and 118 deletions

View File

@@ -1022,11 +1022,11 @@ class Lot(metaclass=PoolMeta):
return True
return False
def createMove(self,r,qt,sh):
Move = Pool().get('stock.move')
nm = Move()
nm.from_location = r.lot_p.line.purchase.from_location
nm.to_location = r.lot_p.line.purchase.to_location
def createMove(self,r,qt,sh):
Move = Pool().get('stock.move')
nm = Move()
nm.from_location = r.lot_p.line.purchase.from_location
nm.to_location = r.lot_p.line.purchase.to_location
nm.product = r.lot_p.lot_product
nm.unit = r.lot_unit
nm.quantity = qt
@@ -1034,11 +1034,32 @@ class Lot(metaclass=PoolMeta):
nm.shipment = sh
nm.currency = r.lot_p.line.currency
nm.unit_price = r.lot_p.line.unit_price
Move.save([nm])
return nm.id
@classmethod
def create(cls, vlist):
Move.save([nm])
return nm.id
def create_shipment_move(self, shipment_origin):
Move = Pool().get('stock.move')
line = self.line
if not line or not getattr(line, 'purchase', None):
return
unit = self.lot_unit or self.lot_unit_line or line.unit
quantity = self.get_current_quantity_converted(0, unit)
move = Move()
move.from_location = line.purchase.from_location
move.to_location = line.purchase.to_location
move.product = self.lot_product
move.unit = unit
move.quantity = quantity
move.origin = line
move.shipment = shipment_origin
move.currency = line.currency
move.unit_price = line.unit_price
move.lot = self
Move.save([move])
return move
@classmethod
def create(cls, vlist):
vlist = [x.copy() for x in vlist]
L = Pool().get('lot.lot')
Uom = Pool().get('product.uom')
@@ -3095,10 +3116,16 @@ class LotShipping(Wizard):
elif self.ship.shipment == 'int':
l.lot_shipment_internal = self.ship.shipment_internal
logger.info("IN_SHIPPING2:%s",l.move)
move = None
if not l.move:
continue
move = l.create_shipment_move(shipment_origin)
if not move:
raise UserError(
"Cannot create shipment move for lot %s."
% l)
logger.info("IN_SHIPPING3:%s",r)
move = Move(l.move)
if not move:
move = Move(l.move)
move.shipment = shipment_origin
Move.save([move])
linked_transit_move = move.get_linked_transit_move()