Generated Sales Order could get the wrong document type
the method org.compiere.model.MOrder.setC_DocTypeTarget_ID(String) try to locate the default document type based on the specified DocSubTypeSO with the following query:
String sql = "SELECT C_DocType_ID FROM C_DocType "
+ "WHERE AD_Client_ID=? AND AD_Org_ID IN (0," + getAD_Org_ID()
+ ") AND DocSubTypeSO=? "
+ " AND IsActive='Y' "
+ "ORDER BY AD_Org_ID DESC, IsDefault DESC";
The problem is it doesn't test for DocBaseType = 'SOO' so it can return any C_DocType which has the "correct" DocSubTypeSO set by mistake
will look at in 390 .. left for now