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.
This commit is contained in:
hengsin 2020-08-25 16:00:30 +08:00 committed by GitHub
parent 0e9f36add9
commit a978949593
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 3 deletions

View File

@ -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())) {
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<String> excludes = defaultExcludeList(mainTable);