This commit is contained in:
2026-03-10 14:44:16 +01:00
parent 1de11a846b
commit 30ae86a987

View File

@@ -464,35 +464,35 @@ class Fee(ModelSQL,ModelView):
# FeeLots.save([fl])
# qt_line += l.get_current_quantity_converted()
# unit = l.line.unit
if fee.sale_line:
for l in fee.sale_line.lots:
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.fee = fee.id
fl.lot = l.id
fl.sale_line = l.sale_line.id
FeeLots.save([fl])
qt_line += l.get_current_quantity_converted()
unit = l.sale_line.unit
if fee.shipment_in:
if fee.shipment_in.state == 'draft'or fee.shipment_in.state == 'started':
lots = Lots.search(['lot_shipment_in','=',fee.shipment_in.id])
if lots:
for l in lots:
fl = FeeLots()
fl.fee = fee.id
fl.lot = l.id
FeeLots.save([fl])
qt_sh += l.get_current_quantity_converted()
unit = l.line.unit
else:
lqts = LotQt.search(['lot_shipment_in','=',fee.shipment_in.id])
if lqts:
for l in lqts:
qt_sh += l.lot_p.get_current_quantity_converted()
unit = l.lot_p.line.unit
else:
raise UserError("You cannot add fee on received shipment!")
# if fee.sale_line:
# for l in fee.sale_line.lots:
# 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.fee = fee.id
# fl.lot = l.id
# fl.sale_line = l.sale_line.id
# FeeLots.save([fl])
# qt_line += l.get_current_quantity_converted()
# unit = l.sale_line.unit
# if fee.shipment_in:
# if fee.shipment_in.state == 'draft'or fee.shipment_in.state == 'started':
# lots = Lots.search(['lot_shipment_in','=',fee.shipment_in.id])
# if lots:
# for l in lots:
# fl = FeeLots()
# fl.fee = fee.id
# fl.lot = l.id
# FeeLots.save([fl])
# qt_sh += l.get_current_quantity_converted()
# unit = l.line.unit
# else:
# lqts = LotQt.search(['lot_shipment_in','=',fee.shipment_in.id])
# if lqts:
# for l in lqts:
# qt_sh += l.lot_p.get_current_quantity_converted()
# unit = l.lot_p.line.unit
# else:
# raise UserError("You cannot add fee on received shipment!")
type = fee.type
if type == 'ordered':