diff --git a/org.adempiere.base/src/org/compiere/model/MTree.java b/org.adempiere.base/src/org/compiere/model/MTree.java index 6de50d774a..3ee329e1f9 100644 --- a/org.adempiere.base/src/org/compiere/model/MTree.java +++ b/org.adempiere.base/src/org/compiere/model/MTree.java @@ -286,7 +286,7 @@ public class MTree extends MTree_Base try { // load Node details - addToTree -> getNodeDetail - getNodeDetails(); + getNodeDetails(linkColName, linkID); // pstmt = DB.prepareStatement(sql.toString(), get_TrxName()); pstmt.setInt(1, getAD_Tree_ID()); @@ -445,7 +445,7 @@ public class MTree extends MTree_Base * - Node_ID * The SQL contains security/access control */ - private void getNodeDetails () + private void getNodeDetails (String linkColName, int linkID) { // SQL for Node Info StringBuilder sqlNode = new StringBuilder(); @@ -506,7 +506,19 @@ public class MTree extends MTree_Base sqlNode.append("t.Description,t.IsSummary,").append(color) .append(" FROM ").append(tableName).append(" t "); if (!m_editable) - sqlNode.append(" WHERE t.IsActive='Y'"); + { + if (Util.isEmpty(linkColName) || linkID==0 ) + sqlNode.append(" WHERE t.IsActive='Y'"); + else + sqlNode.append(" WHERE t.IsActive='Y' AND t.").append(linkColName).append("=").append(linkID); + + }else { + + if (!Util.isEmpty(linkColName) && linkID > 0) + sqlNode.append(" WHERE t.").append(linkColName).append("=").append(linkID); + + } + } else if (isValueDisplayed()) { sqlNode.append("SELECT t.").append(columnNameX) .append("_ID, t.Value || ' - ' || t.Name, t.Description, t.IsSummary,").append(color)