From 72d66b8868fecb4f70dd7b28c1ec52cc08721bce Mon Sep 17 00:00:00 2001 From: hengsin Date: Mon, 25 Jan 2021 00:13:47 +0800 Subject: [PATCH] IDEMPIERE-4667 Project can not be printed using template print format (#550) --- .../src/org/compiere/print/layout/LayoutEngine.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/org.adempiere.base/src/org/compiere/print/layout/LayoutEngine.java b/org.adempiere.base/src/org/compiere/print/layout/LayoutEngine.java index 6b7f7a819a..9e2ee1c4cf 100644 --- a/org.adempiere.base/src/org/compiere/print/layout/LayoutEngine.java +++ b/org.adempiere.base/src/org/compiere/print/layout/LayoutEngine.java @@ -53,6 +53,7 @@ import org.compiere.model.MClientInfo; import org.compiere.model.MQuery; import org.compiere.model.MSysConfig; import org.compiere.model.MTable; +import org.compiere.model.PO; import org.compiere.model.PrintInfo; import org.compiere.print.ArchiveEngine; import org.compiere.print.CPaper; @@ -69,6 +70,7 @@ import org.compiere.print.util.SerializableMatrix; import org.compiere.print.util.SerializableMatrixImpl; import org.compiere.report.MReportLine; import org.compiere.util.CLogger; +import org.compiere.util.CacheMgt; import org.compiere.util.DB; import org.compiere.util.DisplayType; import org.compiere.util.Env; @@ -1649,8 +1651,17 @@ public class LayoutEngine implements Pageable, Printable, Doc additionalLines.put(Integer.valueOf(col), Integer.valueOf(item.getBelowColumn()-1)); if (!item.isSuppressNull()) { + if (item.is_Immutable()) + item = new MPrintFormatItem(item); item.setIsSuppressNull(true); // display size will be set to 0 in TableElement - item.saveEx(); + try { + //this can be tenant or system print format + PO.setCrossTenantSafe(); + item.saveEx(); + } finally { + PO.clearCrossTenantSafe(); + } + CacheMgt.get().reset(MPrintFormat.Table_Name, format.get_ID()); } } columnHeader[col] = new ValueNamePair(item.getColumnName(),