From 969a2e66df1f65840753b85b63fee3d91c71b8e7 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 3 May 2023 20:32:59 +0200 Subject: [PATCH] IDEMPIERE-5238 Fix checkRecordIDCrossTenant failing in multi-key table (#1821) --- org.adempiere.base/src/org/compiere/model/PO.java | 2 ++ .../org/adempiere/pipo2/handler/GenericPOElementHandler.java | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/org.adempiere.base/src/org/compiere/model/PO.java b/org.adempiere.base/src/org/compiere/model/PO.java index 401bf7a69d..56fbf8f091 100644 --- a/org.adempiere.base/src/org/compiere/model/PO.java +++ b/org.adempiere.base/src/org/compiere/model/PO.java @@ -5709,6 +5709,8 @@ public abstract class PO if (tableId <= 0) return; MTable ft = MTable.get(getCtx(), tableId); + if (ft.getKeyColumns().length > 1) + return; // multi-key-table boolean systemAccess = false; String accessLevel = ft.getAccessLevel(); if ( MTable.ACCESSLEVEL_All.equals(accessLevel) diff --git a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/GenericPOElementHandler.java b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/GenericPOElementHandler.java index fe5c6020aa..cf3a961028 100644 --- a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/GenericPOElementHandler.java +++ b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/GenericPOElementHandler.java @@ -104,7 +104,8 @@ public class GenericPOElementHandler extends AbstractElementHandler { element.recordId = po.get_ID(); X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, po.get_TableName(), po.get_Table_ID()); - logImportDetail(ctx, impDetail, 1, po.toString(), element.recordId, action); + boolean isMultiKey = po.get_KeyColumns().length > 1; + logImportDetail(ctx, impDetail, 1, po.toString(), isMultiKey ? 0 : element.recordId, action); if ( I_AD_Window.Table_Name.equals(tableName) || I_AD_Process.Table_Name.equals(tableName)