IDEMPIERE-4112 NPE In Generate Shipment Manually

This commit is contained in:
Orlando Curieles 2019-11-25 15:30:15 +01:00
parent 28cd219450
commit 4739aea8c8
1 changed files with 7 additions and 4 deletions

View File

@ -367,10 +367,13 @@ public class MInOut extends X_M_InOut implements DocAction
//
setM_Warehouse_ID (order.getM_Warehouse_ID());
setIsSOTrx (order.isSOTrx());
if (C_DocTypeShipment_ID == 0)
C_DocTypeShipment_ID = DB.getSQLValue(null,
"SELECT C_DocTypeShipment_ID FROM C_DocType WHERE C_DocType_ID=?",
order.getC_DocType_ID());
if (C_DocTypeShipment_ID == 0) {
MDocType dto = MDocType.get(getCtx(), order.getC_DocTypeTarget_ID());
C_DocTypeShipment_ID = dto.getC_DocTypeShipment_ID();
if (C_DocTypeShipment_ID <= 0)
throw new AdempiereException("@NotFound@ @C_DocTypeShipment_ID@ - @C_DocType_ID@:"
+dto.get_Translation(MDocType.COLUMNNAME_Name));
}
setC_DocType_ID (C_DocTypeShipment_ID);
// patch suggested by Armen