This commit is contained in:
2026-03-10 14:49:10 +01:00
parent 30ae86a987
commit 814071e4c1

View File

@@ -355,16 +355,16 @@ class Fee(ModelSQL,ModelView):
return round(factor * self.sale_line.unit_price * (self.quantity if self.quantity else 0) * sign,2)
elif self.mode == 'perqt':
if self.shipment_in:
StockMove = Pool().get('stock.move')
sm = StockMove.search(['shipment','=','stock.shipment.in,'+str(self.shipment_in.id)])
if sm:
unique_lots = {e.lot for e in sm if e.lot}
return round(self.price * Decimal(sum([e.get_current_quantity_converted() for e in unique_lots])) * sign,2)
LotQt = Pool().get('lot.qt')
lqts = LotQt.search(['lot_shipment_in','=',self.shipment_in.id])
if lqts:
return round(self.price * Decimal(lqts[0].lot_quantity) * sign,2)
# if self.shipment_in:
# StockMove = Pool().get('stock.move')
# sm = StockMove.search(['shipment','=','stock.shipment.in,'+str(self.shipment_in.id)])
# if sm:
# unique_lots = {e.lot for e in sm if e.lot}
# return round(self.price * Decimal(sum([e.get_current_quantity_converted() for e in unique_lots])) * sign,2)
# LotQt = Pool().get('lot.qt')
# lqts = LotQt.search(['lot_shipment_in','=',self.shipment_in.id])
# if lqts:
# return round(self.price * Decimal(lqts[0].lot_quantity) * sign,2)
return round((self.quantity if self.quantity else 0) * self.price * sign,2)
elif self.mode == 'pprice':