diff --git a/modules/purchase_trade/fee.py b/modules/purchase_trade/fee.py index 3115aa7..621f83f 100755 --- a/modules/purchase_trade/fee.py +++ b/modules/purchase_trade/fee.py @@ -307,30 +307,29 @@ class Fee(ModelSQL,ModelView): LotQt = Pool().get('lot.qt') if fee.line: for l in fee.line.lots: - #if l.lot_type == 'physic': - fl = FeeLots() - fl.fee = fee.id - fl.lot = l.id - fl.line = l.line.id - FeeLots.save([fl]) - qt_line += l.get_current_quantity_converted() - unit = l.line.unit + 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.fee = fee.id + fl.lot = l.id + fl.line = l.line.id + 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 == 'physic': - 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 (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: - #if l.lot_type == 'physic': fl = FeeLots() fl.fee = fee.id fl.lot = l.id @@ -360,7 +359,9 @@ class Fee(ModelSQL,ModelView): pl.unit = unit pl.fee_ = fee.id 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.lines = [pl] p.party = fee.supplier