From 22e22fa976bd9123d5b9a6221b204616e97973dc Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Sun, 28 Jan 2024 11:02:54 +0100 Subject: [PATCH] IDEMPIERE-6017 Move/Copy Client failing when there are Record_ID references for AD_ClientInfo or AD_OrgInfo (#2214) - improve discovery of key column - improve avoiding block when the target column is bigger and can hold the source column --- org.adempiere.base/src/org/compiere/model/MTable.java | 2 +- .../src/org/idempiere/process/MoveClient.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MTable.java b/org.adempiere.base/src/org/compiere/model/MTable.java index d5d4e890fd..0f3c958229 100644 --- a/org.adempiere.base/src/org/compiere/model/MTable.java +++ b/org.adempiere.base/src/org/compiere/model/MTable.java @@ -504,7 +504,7 @@ public class MTable extends X_AD_Table implements ImmutablePOSupport } // getKeyColumns /** - * @return true if table has single key column and the key column name ends with _ID. + * @return true if table has single key column and the key column name is the same as the table name plus _ID. */ public boolean isIDKeyTable() { diff --git a/org.adempiere.base/src/org/idempiere/process/MoveClient.java b/org.adempiere.base/src/org/idempiere/process/MoveClient.java index bbb65ef79a..19a856f92f 100644 --- a/org.adempiere.base/src/org/idempiere/process/MoveClient.java +++ b/org.adempiere.base/src/org/idempiere/process/MoveClient.java @@ -534,8 +534,8 @@ public class MoveClient extends SvrProcess { p_errorList.add("Column " + tableName + "." + columnName + " has different type in dictionary, external: " + refID + ", local: " + localColumn.getAD_Reference_ID()); } - // inform blocking if lengths are different - if (length != localColumn.getFieldLength()) { + // inform blocking if external length is bigger than local + if (length > localColumn.getFieldLength()) { p_errorList.add("Column " + tableName + "." + columnName + " has different length in dictionary, external: " + length + ", local: " + localColumn.getFieldLength()); } @@ -1353,7 +1353,7 @@ public class MoveClient extends SvrProcess { String uuidCol = PO.getUUIDColumnName(tableName); MTable table = MTable.get(getCtx(), tableName); String remoteUUID = null; - if (table.isUUIDKeyTable()) { + if (! table.isIDKeyTable()) { remoteUUID = foreign_Key.toString(); } else { StringBuilder sqlRemoteUUSB = new StringBuilder()