This commit is contained in:
2026-01-17 17:36:39 +01:00
parent e8453c76a7
commit 0047e6e879

View File

@@ -307,30 +307,29 @@ class Fee(ModelSQL,ModelView):
LotQt = Pool().get('lot.qt') LotQt = Pool().get('lot.qt')
if fee.line: if fee.line:
for l in fee.line.lots: for l in fee.line.lots:
#if l.lot_type == 'physic': if (l.lot_type == 'virtual' and len(fee.line.lots)==1) or (l.lot_type == 'physic' and len(fee.line.lots)>1):
fl = FeeLots() fl = FeeLots()
fl.fee = fee.id fl.fee = fee.id
fl.lot = l.id fl.lot = l.id
fl.line = l.line.id fl.line = l.line.id
FeeLots.save([fl]) FeeLots.save([fl])
qt_line += l.get_current_quantity_converted() qt_line += l.get_current_quantity_converted()
unit = l.line.unit unit = l.line.unit
if fee.sale_line: if fee.sale_line:
for l in fee.sale_line.lots: for l in fee.sale_line.lots:
#if l.lot_type == 'physic': if (l.lot_type == 'virtual' and len(fee.sale_line.lots)==1) or (l.lot_type == 'physic' and len(fee.sale_line.lots)>1):
fl = FeeLots() fl = FeeLots()
fl.fee = fee.id fl.fee = fee.id
fl.lot = l.id fl.lot = l.id
fl.sale_line = l.sale_line.id fl.sale_line = l.sale_line.id
FeeLots.save([fl]) FeeLots.save([fl])
qt_line += l.get_current_quantity_converted() qt_line += l.get_current_quantity_converted()
unit = l.sale_line.unit unit = l.sale_line.unit
if fee.shipment_in: if fee.shipment_in:
if fee.shipment_in.state == 'draft'or fee.shipment_in.state == 'started': if fee.shipment_in.state == 'draft'or fee.shipment_in.state == 'started':
lots = Lots.search(['lot_shipment_in','=',fee.shipment_in.id]) lots = Lots.search(['lot_shipment_in','=',fee.shipment_in.id])
if lots: if lots:
for l in lots: for l in lots:
#if l.lot_type == 'physic':
fl = FeeLots() fl = FeeLots()
fl.fee = fee.id fl.fee = fee.id
fl.lot = l.id fl.lot = l.id
@@ -360,7 +359,9 @@ class Fee(ModelSQL,ModelView):
pl.unit = unit pl.unit = unit
pl.fee_ = fee.id pl.fee_ = fee.id
if fee.price: if fee.price:
pl.unit_price = round(Decimal(fee.get_price_per_qt()),4) fee_price = fee.get_price_per_qt()
logger.info("GET_FEE_PRICE_PER_QT:%s",fee_price)
pl.unit_price = round(Decimal(fee_price),4)
p = Purchase() p = Purchase()
p.lines = [pl] p.lines = [pl]
p.party = fee.supplier p.party = fee.supplier