diff --git a/base/src/org/compiere/model/CalloutEngine.java b/base/src/org/compiere/model/CalloutEngine.java index b901767056..0be8dd254d 100644 --- a/base/src/org/compiere/model/CalloutEngine.java +++ b/base/src/org/compiere/model/CalloutEngine.java @@ -200,6 +200,29 @@ public class CalloutEngine implements Callout return m_mTab != null ? m_mTab.getActiveCallouts().length > 1 : false; } // isCalloutActive + /** + * Is the current callout being called in the middle of + * another callout doing her works. + * Callout can use GridTab.getActiveCalloutInstance() method + * to find out callout for which field is running. + * @return true if active + */ + protected boolean isThisCalloutActive() + { + if (m_mTab == null) + return false; + //greater than 1 instead of 0 to discount this callout instance + String className = this.getClass().getName(); + String methodName = Thread.currentThread().getStackTrace()[2].getMethodName(); + String calloutName = className + "." + methodName; + int cnt = 0; + for (String activeCallouts : m_mTab.getActiveCallouts()) { + if (activeCallouts.equals(calloutName)) + cnt++; + } + return cnt > 1; + } // isCalloutActive + /** * Set Callout (in)active. * Depreciated as the implementation is not thread safe and diff --git a/base/src/org/compiere/model/CalloutGLJournal.java b/base/src/org/compiere/model/CalloutGLJournal.java index af19e90f83..2793d99fd6 100644 --- a/base/src/org/compiere/model/CalloutGLJournal.java +++ b/base/src/org/compiere/model/CalloutGLJournal.java @@ -49,7 +49,7 @@ public class CalloutGLJournal extends CalloutEngine public String period (Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value) { String colName = mField.getColumnName(); - if (value == null || isCalloutActive()) + if (value == null || isThisCalloutActive()) return ""; int AD_Client_ID = Env.getContextAsInt(ctx, WindowNo, "AD_Client_ID");