Generated Sales Order could get the wrong document type

Description

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

Regards,
Angelo

Environment

None

Activity

Show:
Steven-Adaxa
July 11, 2014, 1:20 AM

will look at in 390 .. left for now

Assignee

Unassigned

Reporter

Angelo Dabalà

Labels

Components

Affects versions

Priority

Major