This commit is contained in:
2026-01-16 21:07:56 +01:00
parent 9edfcd5058
commit 660e714983
5 changed files with 46 additions and 29 deletions

View File

@@ -1990,8 +1990,7 @@ class Line(sequence_ordered(), ModelSQL, ModelView):
'''
pool = Pool()
Move = pool.get('stock.move')
InvoiceLine = pool.get('account.invoice.line')
Uom = pool.get('product.uom')
Location = pool.get('stock.location')
if self.type != 'line':
return
if not self.product:
@@ -2049,24 +2048,24 @@ class Line(sequence_ordered(), ModelSQL, ModelView):
move.from_location = from_location
if to_location.type != 'customer':
move.to_location = 8
move.to_location = Location.get_transit_id()
else:
move.to_location = to_location
unit_price = l.get_lot_price()
if l.invoice_line_prov != None :
prov_inv = InvoiceLine(l.invoice_line_prov)
quantity -= prov_inv.quantity
if quantity < 0 :
move.from_location = self.purchase.to_location
move.to_location = 16
elif quantity > 0 :
move.from_location = 16
move.to_location = self.purchase.to_location
quantity = abs(quantity)
unit_price = prov_inv.unit_price
if quantity == 0:
continue
# if l.invoice_line_prov != None :
# prov_inv = InvoiceLine(l.invoice_line_prov)
# quantity -= prov_inv.quantity
# if quantity < 0 :
# move.from_location = self.purchase.to_location
# move.to_location = 16
# elif quantity > 0 :
# move.from_location = 16
# move.to_location = self.purchase.to_location
# quantity = abs(quantity)
# unit_price = prov_inv.unit_price
# if quantity == 0:
# continue
move.quantity = quantity
move.unit = self.unit
move.product = l.lot_product
@@ -2086,7 +2085,7 @@ class Line(sequence_ordered(), ModelSQL, ModelView):
moves.append(move)
if move.to_location.type != 'customer':
move_to, = Move.copy([move.id], default={
'from_location': 8,
'from_location': Location.get_transit_id(),
'to_location': to_location,
})
moves.append(move_to)