diff --git a/base/src/org/compiere/model/MColumn.java b/base/src/org/compiere/model/MColumn.java index 5a71e148c4..bcd7b96252 100644 --- a/base/src/org/compiere/model/MColumn.java +++ b/base/src/org/compiere/model/MColumn.java @@ -213,6 +213,22 @@ public class MColumn extends X_AD_Column WHERE AD_Table_ID IN (SELECT AD_Table_ID FROM AD_Table WHERE IsView='Y') **/ + /* Diego Ruiz - globalqss - BF [1651899] - AD_Column: Avoid dup. SeqNo for IsIdentifier='Y' */ + if (isIdentifier()) + { + int cnt = DB.getSQLValue(get_TrxName(),"SELECT COUNT(*) FROM AD_Column "+ + "WHERE AD_Table_ID=?"+ + " AND AD_Column_ID!=?"+ + " AND IsIdentifier='Y'"+ + " AND SeqNo=?", + new Object[] {getAD_Table_ID(), getAD_Column_ID(), getSeqNo()}); + if (cnt>0) + { + log.saveError("SaveErrorNotUnique", Msg.getElement(getCtx(), COLUMNNAME_SeqNo)); + return false; + } + } + // Virtual Column if (isVirtualColumn()) {