From a978949593d74eed1b2d30ebf83b6822ac9181f2 Mon Sep 17 00:00:00 2001 From: hengsin Date: Tue, 25 Aug 2020 16:00:30 +0800 Subject: [PATCH] IDEMPIERE-4255 [2pack] Packout reference table call wrong ElementHandler.packOut overloading (#230) Base on patch from hieplq GenericPOElementHandler Export Details - Fix the use of correct ElementHandler for multi key detail table. --- .../pipo2/handler/GenericPOElementHandler.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) 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 c3de35a5b5..f1ed5d7136 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 @@ -51,6 +51,7 @@ import org.compiere.model.PO; import org.compiere.model.X_AD_Package_Imp_Detail; import org.compiere.util.DB; import org.compiere.util.Env; +import org.compiere.util.Util; import org.xml.sax.SAXException; import org.xml.sax.helpers.AttributesImpl; @@ -235,13 +236,21 @@ public class GenericPOElementHandler extends AbstractElementHandler { boolean createElement = isPackOutElement(ctx, po); if (createElement) { - if (po.get_ID() > 0) { - ElementHandler handler = ctx.packOut.getHandler(po.get_TableName()); - if (handler != null && !handler.getClass().equals(this.getClass()) ) { + + ElementHandler handler = ctx.packOut.getHandler(po.get_TableName()); + if (handler != null && !handler.getClass().equals(this.getClass())) { + if (po.get_ID() > 0 && po.get_KeyColumns().length==1) { handler.packOut(ctx.packOut, document, ctx.logDocument, po.get_ID()); createElement = false; + } else { + String uuid = po.get_ValueAsString(po.getUUIDColumnName()); + if (!Util.isEmpty(uuid, true)) { + handler.packOut(ctx.packOut, document, ctx.logDocument, -1, uuid); + createElement = false; + } } } + if (createElement) { verifyPackOutRequirement(po); List excludes = defaultExcludeList(mainTable);