diff --git a/org.adempiere.base/src/org/compiere/model/MRole.java b/org.adempiere.base/src/org/compiere/model/MRole.java index 83cbea199b..df2a3073cf 100644 --- a/org.adempiere.base/src/org/compiere/model/MRole.java +++ b/org.adempiere.base/src/org/compiere/model/MRole.java @@ -2023,10 +2023,14 @@ public final class MRole extends X_AD_Role } where.append(")"); } - else if (excludes.size() == 1) - where.append(whereColumnName).append("<>").append(excludes.get(0)); + else if (excludes.size() == 1) + { + where.append("(" + whereColumnName + " IS NULL OR "); + where.append(whereColumnName).append("<>").append(excludes.get(0)).append(")"); + } else if (excludes.size() > 1) - { + { + where.append("(" + whereColumnName + " IS NULL OR "); where.append(whereColumnName).append(" NOT IN ("); for (int ii = 0; ii < excludes.size(); ii++) { @@ -2034,7 +2038,7 @@ public final class MRole extends X_AD_Role where.append(","); where.append(excludes.get(ii)); } - where.append(")"); + where.append("))"); } log.finest(where.toString()); return where.toString(); @@ -2324,8 +2328,9 @@ public final class MRole extends X_AD_Role if (lockedIDs != null) { if (sb.length() > 0) - sb.append(" AND "); - sb.append(keyColumnName).append(lockedIDs); + sb.append(" AND "); + sb.append(" (" + keyColumnName + " IS NULL OR "); + sb.append(keyColumnName).append(lockedIDs).append(") "); } } //