IDEMPIERE-1884 phantom shipment record create when create wrong Drop Shipment

This commit is contained in:
Carlos Ruiz 2014-04-09 12:40:21 -05:00
parent 8b603ec432
commit 1c3b7c4179
1 changed files with 9 additions and 11 deletions

View File

@ -1706,6 +1706,10 @@ public class MInOut extends X_M_InOut implements DocAction
if ( isSOTrx() || !isDropShip() || getC_Order_ID() == 0 ) if ( isSOTrx() || !isDropShip() || getC_Order_ID() == 0 )
return null; return null;
int linkedOrderID = new MOrder (getCtx(), getC_Order_ID(), get_TrxName()).getLink_Order_ID();
if (linkedOrderID <= 0)
return null;
// Document Type // Document Type
int C_DocTypeTarget_ID = 0; int C_DocTypeTarget_ID = 0;
MDocType[] shipmentTypes = MDocType.getOfDocBaseType(getCtx(), MDocType.DOCBASETYPE_MaterialDelivery); MDocType[] shipmentTypes = MDocType.getOfDocBaseType(getCtx(), MDocType.DOCBASETYPE_MaterialDelivery);
@ -1720,18 +1724,12 @@ public class MInOut extends X_M_InOut implements DocAction
MInOut dropShipment = copyFrom(this, getMovementDate(), getDateAcct(), MInOut dropShipment = copyFrom(this, getMovementDate(), getDateAcct(),
C_DocTypeTarget_ID, !isSOTrx(), false, get_TrxName(), true); C_DocTypeTarget_ID, !isSOTrx(), false, get_TrxName(), true);
int linkedOrderID = new MOrder (getCtx(), getC_Order_ID(), get_TrxName()).getLink_Order_ID(); dropShipment.setC_Order_ID(linkedOrderID);
if (linkedOrderID != 0)
{
dropShipment.setC_Order_ID(linkedOrderID);
// get invoice id from linked order // get invoice id from linked order
int invID = new MOrder (getCtx(), linkedOrderID, get_TrxName()).getC_Invoice_ID(); int invID = new MOrder (getCtx(), linkedOrderID, get_TrxName()).getC_Invoice_ID();
if ( invID != 0 ) if ( invID != 0 )
dropShipment.setC_Invoice_ID(invID); dropShipment.setC_Invoice_ID(invID);
}
else
return null;
dropShipment.setC_BPartner_ID(getDropShip_BPartner_ID()); dropShipment.setC_BPartner_ID(getDropShip_BPartner_ID());
dropShipment.setC_BPartner_Location_ID(getDropShip_Location_ID()); dropShipment.setC_BPartner_Location_ID(getDropShip_Location_ID());