From 444011ff64a5783d393b2aecab21a5ce859a7e88 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Tue, 30 Nov 2021 05:25:48 +0100 Subject: [PATCH] IDEMPIERE-5058 Pack In from a tenant print format just packed out throws cross tenant error because of Print Paper (#1008) --- .../pipo2/handler/PrintFormatElementHandler.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/PrintFormatElementHandler.java b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/PrintFormatElementHandler.java index c481f6337a..4d1ffa819a 100644 --- a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/PrintFormatElementHandler.java +++ b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/PrintFormatElementHandler.java @@ -41,6 +41,7 @@ import org.compiere.model.X_AD_PrintFormat; import org.compiere.model.X_AD_PrintFormatItem; import org.compiere.print.MPrintFormat; import org.compiere.print.MPrintFormatItem; +import org.compiere.print.MPrintPaper; import org.compiere.util.DB; import org.compiere.util.Env; import org.xml.sax.SAXException; @@ -101,10 +102,13 @@ public class PrintFormatElementHandler extends AbstractElementHandler { MPrintFormat m_Printformat = new MPrintFormat(ctx.ctx, AD_PrintFormat_ID, null); if (m_Printformat.getAD_PrintPaper_ID() > 0) { - try { - ctx.packOut.getHandler(I_AD_PrintPaper.Table_Name).packOut(ctx.packOut, document, ctx.logDocument, m_Printformat.getAD_PrintPaper_ID()); - } catch (Exception e) { - throw new SAXException(e); + MPrintPaper pp = MPrintPaper.get(m_Printformat.getAD_PrintPaper_ID()); + if (pp.getAD_Client_ID() == m_Printformat.getAD_Client_ID()) { + try { + ctx.packOut.getHandler(I_AD_PrintPaper.Table_Name).packOut(ctx.packOut, document, ctx.logDocument, m_Printformat.getAD_PrintPaper_ID()); + } catch (Exception e) { + throw new SAXException(e); + } } }