diff --git a/org.adempiere.base/src/org/compiere/model/MInOut.java b/org.adempiere.base/src/org/compiere/model/MInOut.java index 941a5a8d83..dc71e605d5 100644 --- a/org.adempiere.base/src/org/compiere/model/MInOut.java +++ b/org.adempiere.base/src/org/compiere/model/MInOut.java @@ -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